Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Affan-7/7c213f815b66ef54b6bff4e6f2eb77dc to your computer and use it in GitHub Desktop.
Save Affan-7/7c213f815b66ef54b6bff4e6f2eb77dc to your computer and use it in GitHub Desktop.
Ansible playbook code to install apache server on amazon linux
---
- name: Install apache server # name of the playbook
hosts: ec2 # target group defined in the inventory file
become: yes
tasks:
- name: install apache server # name of the play
yum:
name: httpd
state: latest
update_cache: yes
- name: start and enable autostart of apache server
systemd:
name: httpd
state: started
enabled: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment