Skip to content

Commit

Permalink
feat: make user can execute the script
Browse files Browse the repository at this point in the history
  • Loading branch information
kencho51 committed Sep 9, 2024
1 parent ccab65c commit 1adfa18
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions ops/infrastructure/roles/bastion-users/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,28 @@
mode: 0644
when: credentials_csv_path is defined

- name: Ensure user has GIGADB_ENV set
ansible.builtin.lineinfile:
path: "/home/{{ newuser }}/.bash_profile"
insertafter: '# User specific environment and startup programs\n'
line: "GIGADB_ENV={{ gigadb_environment }}"

- name: get private key of upstream
ansible.builtin.uri:
url: "{{ gitlab_misc_url }}/variables/id_rsa_aws_hk_gigadb_pem"
method: GET
headers:
PRIVATE-TOKEN: "{{ gitlab_private_token }}"
body_format: json
register: private_key_from_gl

- name: copy private key
ansible.builtin.copy:
content: "{{ private_key_from_gl.json.value }}"
dest: "/home/{{ newuser }}/.ssh/id-rsa-aws-hk-gigadb.pem"
owner: "{{ newuser }}"
group: "{{ newuser }}"
mode: g-rw,o-rw

- name: Restart systemd sshd service
command: systemctl restart sshd.service

0 comments on commit 1adfa18

Please sign in to comment.