additional course material RH294
Olaf Bohlen
2020-08-20 1de6236f80a879ca110981fe0e5c0c05c521225b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
---
- name: Introduce roles
  hosts: server
  become: true
  pre_tasks:
    - name: pre_tasks run here
      debug:
        msg: 'this runs before the roles'
  roles:
    - prep_server
  tasks:
    - name: prepare sample html content
      copy:
        dest: /var/www/htdocs/index.html
        content: "foobar"
      notify: "set permissions"
  post_tasks:
    - name: post_tasks run here
      debug:
        msg: 'this runs after the roles'
    - name: retrieve content from port 80
      uri:
        url: "http://localhost:80/index.html"
        return_content: yes
      when: port == 'http'
  handlers:
    - name: set permissions
      file:
        dest: /var/www/htdocs/index.html
        mode: 644