#28 inventory: make rhts role compatible with dynamic containers
Merged 6 years ago by stefw. Opened 6 years ago by merlinm.

@@ -4,6 +4,7 @@

    with_items:

    - rsync                       # need rsync for Ansible synchronize module

    - dnf-plugins-core            # need COPR plugin

+   - openssh-server

    - beakerlib

    - make

    - createrepo
@@ -128,16 +129,42 @@

    file:

      dest: /root/.ssh

      state: directory

+     mode: 0700

  

  - name: Create root SSH key pair

    shell: ssh-keygen -q -t rsa -N '' -f /root/.ssh/id_rsa

    args:

      creates: /root/.ssh/id_rsa

  

+ - name: Procure root public key

+   shell: cat /root/.ssh/id_rsa.pub

+   register: my_pub_key_output

+ 

  - name: Configure password-less local SSH for restraint

-   shell: |

-     cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys

-     chmod 644 /root/.ssh/authorized_keys

+   authorized_key:

+     user: root

+     state: present

+     key: "{{ my_pub_key_output.stdout }}"

+ 

+ - name: Check if SSHD is running

+   wait_for: port=22 search_regex=OpenSSH timeout=3

+   ignore_errors: true

+   register: sshd_check

+ 

+ - block: # SSHD not running; configure and start it

+ 

+   - name: Create host SSH key pair

+     shell: ssh-keygen -q -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key

+     args:

+       creates: /etc/ssh/ssh_host_rsa_key

+ 

+   - name: Start SSHD in background

+     shell: /usr/sbin/sshd

+ 

+   - name: Wait for SSHD to start

+     wait_for: port=22 search_regex=OpenSSH

+ 

+   when: sshd_check|failed

  

  - name: Clear artifacts directory

    file: path={{ remote_artifacts }} state=absent

Update standard-test-rhts role to make it compatible with containers started by the standard-inventory-docker. Specifically, SSHD needs to be installed, configured, and started if it hasn't already.

rebased

6 years ago

This fixed the issue for me. I agree with having this in the standard-roles-rhts logic rather than docker specific logic. Nice.

Pull-Request has been merged by stefw

6 years ago
Metadata