aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Renner Berthing <esmil@labitat.dk>2018-09-30 19:42:49 +0200
committerEmil Renner Berthing <esmil@labitat.dk>2018-09-30 20:04:05 +0200
commite724d7a1abfde2f874720048d33ac834c49cdf6e (patch)
tree60df30b62359a8ef5f23ec3eb94997dd22c116f8
parent125d5a727d78863d8f9c2f5906425e0b1eb26651 (diff)
downloadlabitat-ansible-e724d7a1abfde2f874720048d33ac834c49cdf6e.tar.gz
labitat-ansible-e724d7a1abfde2f874720048d33ac834c49cdf6e.tar.xz
labitat-ansible-e724d7a1abfde2f874720048d33ac834c49cdf6e.zip
Make it easier to run locally
Now you just need ansible-playbook <playbook> when running ansible from your workstation. However when running ansible on the target machine it's a good idea to add "-clocal". Otherwise ansible will ssh to itself :/
-rw-r--r--ansible.cfg13
-rw-r--r--inventory1
-rw-r--r--roles/space_server/files/ansible/hosts11
-rw-r--r--roles/space_server/tasks/ansible.yml33
-rw-r--r--roles/space_server/tasks/main.yml2
-rw-r--r--space.yml2
6 files changed, 15 insertions, 47 deletions
diff --git a/ansible.cfg b/ansible.cfg
new file mode 100644
index 0000000..903d823
--- /dev/null
+++ b/ansible.cfg
@@ -0,0 +1,13 @@
+[defaults]
+inventory = inventory
+hash_behaviour = merge
+error_on_missing_handler = True
+
+[ssh_connection]
+pipelining = True
+
+[privilege_escalation]
+become = True
+become_method = sudo
+become_user = root
+become_ask_pass = False
diff --git a/inventory b/inventory
new file mode 100644
index 0000000..227a8de
--- /dev/null
+++ b/inventory
@@ -0,0 +1 @@
+space.labitat.dk
diff --git a/roles/space_server/files/ansible/hosts b/roles/space_server/files/ansible/hosts
deleted file mode 100644
index 3091e4a..0000000
--- a/roles/space_server/files/ansible/hosts
+++ /dev/null
@@ -1,11 +0,0 @@
-# This is the default ansible 'hosts' file.
-#
-# It should live in /etc/ansible/hosts
-#
-# - Comments begin with the '#' character
-# - Blank lines are ignored
-# - Groups of hosts are delimited by [header] elements
-# - You can enter hostnames or ip addresses
-# - A hostname/ip can be a member of multiple groups
-
-space ansible_connection=local
diff --git a/roles/space_server/tasks/ansible.yml b/roles/space_server/tasks/ansible.yml
deleted file mode 100644
index 209cb5b..0000000
--- a/roles/space_server/tasks/ansible.yml
+++ /dev/null
@@ -1,33 +0,0 @@
----
-- name: Create /etc/ansible/hosts
- copy:
- dest: '/etc/ansible/hosts'
- src: ansible/hosts
- owner: root
- group: root
- mode: 0644
-
-- name: Configure ansible
- ini_file:
- path: '/etc/ansible/ansible.cfg'
- section: '{{ item.section }}'
- option: '{{ item.option }}'
- value: '{{ item.value }}'
- with_items:
- - section: defaults
- option: 'gathering'
- value: 'smart'
- - section: defaults
- option: 'fact_caching'
- value: 'jsonfile'
- - section: defaults
- option: 'fact_caching_connection'
- value: '/tmp/ansible'
- - section: defaults
- option: 'fact_caching_timeout'
- value: '600'
- - section: defaults
- option: 'error_on_missing_handler'
- value: 'True'
-
-# vim: set ts=2 sw=2 et:
diff --git a/roles/space_server/tasks/main.yml b/roles/space_server/tasks/main.yml
index 0a0aed0..5b93e60 100644
--- a/roles/space_server/tasks/main.yml
+++ b/roles/space_server/tasks/main.yml
@@ -9,8 +9,6 @@
tags:
- fstab
-- import_tasks: ansible.yml
- tags: ansible
- import_tasks: sudo.yml
tags: sudo
- import_tasks: kernel.yml
diff --git a/space.yml b/space.yml
index 2df78e5..637c1fb 100644
--- a/space.yml
+++ b/space.yml
@@ -1,5 +1,5 @@
---
-- hosts: space
+- hosts: space.labitat.dk
pre_tasks:
- name: Detect chroot
set_fact: