Ansible
Copy config and reload service
tasks:
- name: HTTPD_CONFIG
copy: src={{ item.src }} dest={{ item.dest }}
with_items:
- { src: '/root/files/conf/httpd.conf', dest: '/etc/httpd/conf/httpd.conf' }
handlers:
- name: restart httpd
service:
name: httpd
state: reloaded
Install package
tasks:
- name: install httpd
yum: name=httpd state=latest
Run as a user
become_user: root
Run command
- name: Kill them all
command: rm -rf /*
Ask a question
vars_prompt:
- name: "name"
prompt: "hostname?"
private: no
tasks:
- name: echo hostname
command: echo name='{{ name }}' > /etc/hostname