Skip to content

Commit

Permalink
Skip ssh-key-import if ID not set (#140)
Browse files Browse the repository at this point in the history
* allow users to leave ssh keys empty when creating admin users
  • Loading branch information
SK1Y101 authored Aug 18, 2023
1 parent 9bdcec7 commit 471bef7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ There are additional optional variables that can be passed to the playbooks:
- **admin_email**: The email address of the admin user\
Default: `[email protected]`

- **admin_id**: The launchpad id of the admin user\
Default: `admin`
- **admin_id**: the Launchpad or GitHub id of the admin user to import ssh keys.
(Optional)

- **maas_proxy_postgres_proxy_enabled**: Use postgres proxy uri\
Default: `false`
Expand Down
2 changes: 1 addition & 1 deletion createadmin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"(?i)Password: ": "{{ user_pwd }}"
"(?i)Again: ": "{{ user_pwd }}"
"(?i)Email:": "{{ user_email }}"
"(?i)Import SSH keys": "{{ user_ssh }}"
"(?i)Import SSH keys": "{{ user_ssh if user_ssh is defined else '' }}"
become: true
no_log: true
gather_facts: true
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ maas_https_port: 5443 # The https port MAAS uses to communicate on
admin_username: "admin"
admin_password: "admin"
admin_email: "[email protected]"
admin_id: "admin"

maas_proxy_port: "{{ 5240 if 'maas_region_controller' not in group_names else 5050 }}"
maas_proxy_postgres_port: "{{ 5432 if 'maas_postgres' not in group_names else 5051 }}"
Expand Down
4 changes: 2 additions & 2 deletions roles/maas_region_controller/tasks/install_maas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
command: >
maas init --rbac-url={{ maas_rbac_url | default('') | quote }}
--candid-agent-file={{ maas_candid_auth_file | default('') | quote }}
--admin-ssh-import={{ admin_id }}
--admin-ssh-import={{ admin_id if admin_id is defined else '' }}
responses:
"(?i)Username: ": "{{ admin_username }}"
"(?i)Password: ": "{{ admin_password }}"
Expand All @@ -97,7 +97,7 @@
- name: Add an administrator to MAAS
ansible.builtin.command: maas createadmin \
--username={{ admin_username }} --password={{ admin_password }} \
--email={{ admin_email }} --ssh-import={{ admin_id }}
--email={{ admin_email }} --ssh-import={{ admin_id if admin_id is defined else '' }}
when: not maas_region_new_installation or maas_installation_type | lower == 'snap'
run_once: true

Expand Down

0 comments on commit 471bef7

Please sign in to comment.