Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

operator: add operator_authorized_github_accounts parameter #524

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion roles/operator/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ The default shell for the operator.
.. zuul:rolevar:: operator_authorized_keys
:default: []

A list of ssh authorized keys to add.
List of SSH public keys to add to the authorized keys for the operator account.

.. zuul:rolevar:: operator_authorized_github_accounts
:default: []

List of Github accounts from which the SSH public keys are added to the authorized keys.

.. zuul:rolevar:: operator_password

Expand Down
1 change: 1 addition & 0 deletions roles/operator/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ operator_group_id: 45000
operator_shell: /bin/bash

operator_authorized_keys: []
operator_authorized_github_accounts: []

# NOTE: Use "mkpasswd --method=sha-512" to generate a password
# operator_password:
Expand Down
7 changes: 7 additions & 0 deletions roles/operator/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@
loop: "{{ operator_authorized_keys }}"
no_log: true
berendt marked this conversation as resolved.
Show resolved Hide resolved

- name: Set authorized github accounts
become: true
ansible.posix.authorized_key:
key: "{{ lookup('url', 'https://github.com/' + item + '.keys', split_lines=False) }}"
user: "{{ operator_user }}"
loop: "{{ operator_authorized_github_accounts }}"

- name: Set password of operator user
become: true
ansible.builtin.user:
Expand Down