Skip to content

Instantly share code, notes, and snippets.

---
- hosts: loadbalancer
become: true
tasks:
- name: install nginx
yum: name=epel-release state=present
yum: name=nginx state=present
[opc@vm04 ansible]$ ansible-playbook loadbalancer.yml
[WARNING]: While constructing a mapping from /home/opc/ansible/loadbalancer.yml, line
5, column 7, found a duplicate dict key (yum). Using last defined value only.
PLAY [loadbalancer] ************************************************************
TASK [setup] *******************************************************************
ok: [129.146.34.164]
---
- hosts: loadbalancer
become: true
tasks:
- name: install epel
yum: name=epel-release state=present
tasks:
-name: install nginx
yum: name=nginx state=present
---
- hosts: loadbalancer
become: true
tasks:
- name: install epel
yum: name=epel-release state=present
tasks:
-name: install nginx
yum: name=nginx state=present
[opc@vm04 ansible]$ ansible-playbook loadbalancer.yml
[WARNING]: While constructing a mapping from /home/opc/ansible/loadbalancer.yml, line
2, column 3, found a duplicate dict key (tasks). Using last defined value only.
PLAY [loadbalancer] ************************************************************
TASK [setup] *******************************************************************
ok: [129.146.34.164]
---
- hosts: loadbalancer
become: true
tasks:
- name: install epel
yum: name=epel-release state=present
tasks:
- name: install nginx
yum: name=nginx state=present
[opc@vm04 ansible]$ ansible-playbook loadbalancer.yml
[WARNING]: While constructing a mapping from /home/opc/ansible/loadbalancer.yml, line
2, column 3, found a duplicate dict key (tasks). Using last defined value only.
PLAY [loadbalancer] ************************************************************
TASK [setup] *******************************************************************
ok: [129.146.34.164]
---
- hosts: loadbalancer
become: true
tasks:
- name: install epel
yum: name=epel-release state=present
- name: install nginx
yum: name=nginx state=present
[opc@vm04 ansible]$ ansible-playbook loadbalancer.yml
PLAY [loadbalancer] ************************************************************
TASK [setup] *******************************************************************
ok: [129.146.34.164]
TASK [install epel] ************************************************************
fatal: [129.146.34.164]: FAILED! => {"changed": false, "failed": true, "msg": "No packag e matching 'epel-release' found available, installed or updated", "rc": 126, "results": ["No package matching 'epel-release' found available, installed or updated"]}
to retry, use: --limit @/home/opc/ansible/loadbalancer.retry
---
- hosts: loadbalancer
become: true
tasks:
- name: install epel
yum: rpm -ivh epel-release-7-9.noarch.rpm
yum: name=epel-release state=present
- name: install nginx
yum: name=nginx state=present