0
Q:

ansible playbook webserver

# Configure ansible.cfg and hosts first

ansible webserver -m package -a "name=httpd state=present"

ansible webserver -m copy -a "src=~/index.html dest=/var/www/html/"

ansible webserver -m service -a "name=httpd state=started"

ansible webserver -m service -a "name=firewalld state=stopped"
1
- hosts: "webserver"
  tasks:
  - name: "installing webserver"
    package:
        name: "httpd"
        state: "present"
  - name: "copying index.html"
    copy:
        src: "~/index.html"
        dest: "/var/www/html/"
  - name: "starting httpd service"
    service:
        name: "httpd"
        state: "started"

  - name: "stopping firewalld service"
    service:
        name: "firewalld"
        state: "stopped"
0

New to Communities?

Join the community