First working Ansible playbook file set

This commit is contained in:
troymc 2016-08-22 17:25:30 +02:00
parent 5c6a3b7457
commit 6e5975dadc
4 changed files with 16 additions and 9 deletions

View File

@ -1,4 +1,5 @@
---
# Variables here are for all host groups
# ansible/group_vars/all
# Variables in this file are for *all* host groups (i.e. all hosts)
example_var: 23

View File

@ -1,9 +1,9 @@
---
# This playbook deploys a BigchainDB node in one machine (one-m).
- name: deploy all software and configure it
- name: install + configure + start all software
hosts: all
remote_user: root
remote_user: ubuntu
roles:
- common

View File

@ -1,10 +1,9 @@
---
# This file should be in roles - common - handlers
# Handler to handle common notifications. Handlers are called by other plays.
# ansible/roles/common/handlers/main.yml
# See http://docs.ansible.com/playbooks_intro.html for more information about handlers.
- name: restart ntp
service: name=ntpd state=restarted
- name: restart iptables
service: name=iptables state=restarted
#- name: restart iptables
# service: name=iptables state=restarted

View File

@ -1,18 +1,24 @@
---
# ansible/roles/common/tasks/main.yml
# Note: "become: true" basically means "become root user for this task" i.e. sudo <cmd>
# See https://docs.ansible.com/ansible/become.html
- name: Do the equivalent of apt-get update
- name: Do the equivalent of "sudo apt-get update"
apt: update_cache=yes
become: true
- name: Uninstall ntpdate (deprecated)
apt: name=ntpdate state=absent
become: true
tags: ntp
- name: Update all installed packages to their latest versions
apt: upgrade=dist
become: true
- name: Install ntp
apt: name=ntp state=latest update_cache=yes
become: true
tags: ntp
#- name: Configure ntp file
@ -22,7 +28,8 @@
# notify: restart ntp
- name: Start the ntp service
service: name=ntpd state=started enabled=yes
service: name=ntp state=started enabled=yes
become: true
tags: ntp
#- name: test to see if selinux is running