summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--devel/Makefile4
-rw-r--r--devel/README.md7
-rw-r--r--devel/fix_ssh.yml63
l---------devel/inventory1
4 files changed, 75 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile
new file mode 100644
index 0000000..98d0e12
--- /dev/null
+++ b/devel/Makefile
@@ -0,0 +1,4 @@
+INVENTORY := ./inventory
+
+fix_ssh:
+ @ansible-playbook -i ${INVENTORY} fix_ssh.yml
diff --git a/devel/README.md b/devel/README.md
new file mode 100644
index 0000000..2ae91f2
--- /dev/null
+++ b/devel/README.md
@@ -0,0 +1,7 @@
+This folder contains ansible playbooks which are useful when manual access to the test machines are required. These are not run during automated testing.
+
+The Makefile targets are as follows
+
+##fix_ssh:
+Fix the ssh on the test machines so that you can directly ssh into them. Before you can use this target, you will need to create authorized_keys file in the directory which will be copied to /root/.ssh/authorized_keys on the test machine.
+
diff --git a/devel/fix_ssh.yml b/devel/fix_ssh.yml
new file mode 100644
index 0000000..f2db45e
--- /dev/null
+++ b/devel/fix_ssh.yml
@@ -0,0 +1,63 @@
+# Create an authorized_keys file in the local directory containing the public keys for ssh access to the remote machine.
+---
+- hosts: all
+ become: yes
+ tasks:
+
+ - name: Check if authorized_keys exist
+ local_action: stat path=authorized_keys
+ register: authorized_keys
+ become: no
+
+ - assert:
+ that:
+ - authorized_keys.stat.exists
+ fail_msg: "authorized_keys does not exist. Please add an authorized_keys file which will be copied over to the test vms."
+ run_once: true
+
+ - name: Allow all users to sudo
+ lineinfile:
+ path: /etc/sudoers
+ state: present
+ insertafter: EOF
+ line: 'ALL ALL=(ALL) NOPASSWD: ALL'
+
+ - name: allow password authentication
+ lineinfile:
+ path: /etc/ssh/sshd_config
+ state: present
+ regexp: '^PasswordAuthentication no'
+ line: 'PasswordAuthentication yes'
+
+ - name: Restart sshd
+ service:
+ name: sshd
+ state: restarted
+
+ #Password: 'x'
+ - name: change root password
+ user:
+ name: root
+ update_password: always
+ password: "$6$wEc5aSnByo3LM51M$TQzO2oyTmHzSncT/SGdVJAbCpuMOwfJSE2dS9p.L0gcFiG5./PqBREtDMdmxFZsuj1M5sq7iGoeoaKmt661Zh1"
+
+ - name: Create /root/.ssh
+ file:
+ path: /root/.ssh
+ owner: root
+ group: root
+ mode: 0700
+ state: directory
+
+ - name: Copy authorized_keys to /root/.ssh
+ copy:
+ src: authorized_keys
+ dest: /root/.ssh/authorized_keys
+ owner: root
+ group: root
+ mode: 0600
+
+ - name: Install net-tools
+ yum:
+ name: net-tools
+ state: present
diff --git a/devel/inventory b/devel/inventory
new file mode 120000
index 0000000..7213b6d
--- /dev/null
+++ b/devel/inventory
@@ -0,0 +1 @@
+../vagrant/vagrant_ansible_inventory \ No newline at end of file