diff options
author | Sachin Prabhu <sprabhu@redhat.com> | 2021-04-13 19:01:23 +0100 |
---|---|---|
committer | Anoop C S <anoopcs@cryptolab.net> | 2021-04-23 16:47:09 +0530 |
commit | 16c4d45090bc58415a661ad09880c2f4f52fc77c (patch) | |
tree | b038e233974d638b3078281ae2f75b5694185a2d /devel | |
parent | dd8b696d84183ab59e526d7fa99332f7a798ded9 (diff) | |
download | samba-integration-16c4d45090bc58415a661ad09880c2f4f52fc77c.tar.gz samba-integration-16c4d45090bc58415a661ad09880c2f4f52fc77c.tar.xz samba-integration-16c4d45090bc58415a661ad09880c2f4f52fc77c.zip |
Add devel ansible playbooks
These ansible playbooks are useful when manual access to the test vms
are required. These aren't run as part of the automated testing.
The first ansible playbook is fix_ssh.yml which modifies configuration
to allow for root login and and copies over authorized_keys file.
Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Diffstat (limited to 'devel')
-rw-r--r-- | devel/Makefile | 4 | ||||
-rw-r--r-- | devel/README.md | 7 | ||||
-rw-r--r-- | devel/fix_ssh.yml | 63 | ||||
l--------- | devel/inventory | 1 |
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 |