Ansible playbook with multiple play
This file contains 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
--- | |
- hosts: mongodb_servers | |
tasks: | |
- name: Add APT key | |
apt_key: | |
keyserver: "hkp://keyserver.ubuntu.com:80" | |
id: "0C49F3730359A14518585931BC711F9BA15703C6" | |
- name: Add APT repository | |
apt_repository: | |
repo: deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse | |
state: present | |
filename: 'mongodb-org-3.4' | |
- name: Update repo list and download mongodb package | |
apt: | |
name: mongodb-org | |
update_cache: yes | |
- name: Start the mongodb service | |
service: | |
name: mongod | |
state: started | |
- hosts: web_servers | |
vars: | |
http_port: 80 | |
tasks: | |
- name: ensure apache is at the latest version | |
yum: | |
name: httpd | |
state: latest | |
- name: write the apache config file | |
template: | |
src: /srv/httpd.j2 | |
dest: /etc/httpd.conf | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment