Created
November 19, 2019 21:10
-
-
Save wtcross/7421952cc2f8ffe2fa47734affc8212f to your computer and use it in GitHub Desktop.
Example Ansible playbook that uses vars
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: install and start apache | |
hosts: web | |
become: yes | |
vars: | |
http_port: 80 | |
tasks: | |
- name: httpd package is present | |
yum: | |
name: httpd | |
state: latest | |
- name: latest index.html file is present | |
template: | |
src: files/index.html | |
dest: /var/www/html/ | |
- name: firewall allows http traffic | |
firewalld: | |
port: "{{ http_port }}/tcp" | |
permanent: yes | |
state: enabled | |
- name: httpd is started | |
service: | |
name: httpd | |
state: started |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment