Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions roles/maas/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ postgres_version: "16"
maas_version: "3.6"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit message: this is a "task", not a module

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will squash all my commits later.

maas_install_method: "apt"
maas_home_dir: "/home/ubuntu/maas"
global_kernel_opt: "console=tty0 console=ttyS1,115200"

# DNS variables
default_domains:
Expand Down
16 changes: 10 additions & 6 deletions roles/maas/tasks/config_maas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,14 @@
ansible.builtin.blockinfile:
path: "{{ curtin_userdata_path.stdout if maas_install_method == 'snap' else '/etc/maas/preseeds/curtin_userdata' }}"
insertafter: EOF
block: |
90_create_cm_user: ["curtin", "in-target", "--", "sh", "-c", "useradd {{ cm_user }} -m -s /bin/bash -g sudo"]
92_delete_cm_pass: ["curtin", "in-target", "--", "sh", "-c", "passwd -d cm"]
94_configure_sudo: ["curtin", "in-target", "--", "sh", "-c", "printf '%%sudo ALL=(ALL) NOPASSWD: ALL\nDefaults !requiretty\nDefaults visiblepw' >> /etc/sudoers.d/cephlab_sudo"]
96_create_ssh_directory: ["curtin", "in-target", "--", "sh", "-c", "mkdir -p /home/cm/.ssh"]
98_copy_ssh_keys_cm: ["curtin", "in-target", "--", "sh", "-c", "echo '{{ cm_user_ssh_keys|join('\n') }}' >> /home/cm/.ssh/authorized_keys"]
block: |2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change the indent level and add this weird indent-removal character?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you add the block inside the curtin script you need to use the exact indent level the file already has otherwise curtin will ignore those commands.

90_create_cm_user: ["curtin", "in-target", "--", "sh", "-c", "useradd {{ cm_user }} -m -s /bin/bash -g sudo"]
92_delete_cm_pass: ["curtin", "in-target", "--", "sh", "-c", "passwd -d cm"]
94_configure_sudo: ["curtin", "in-target", "--", "sh", "-c", "printf '%%sudo ALL=(ALL) NOPASSWD: ALL\nDefaults !requiretty\nDefaults visiblepw' >> /etc/sudoers.d/cephlab_sudo"]
96_create_ssh_directory: ["curtin", "in-target", "--", "sh", "-c", "mkdir -p /home/cm/.ssh"]
98_copy_ssh_keys_cm: ["curtin", "in-target", "--", "sh", "-c", "echo '{{ cm_user_ssh_keys|join('\n') }}' >> /home/cm/.ssh/authorized_keys"]
when: "cm_user_ssh_keys is defined and cm_user is defined"

- name: Configure global kernel options
command: "maas {{ maas_admin_username }} maas set-config name=kernel_opts value='{{ global_kernel_opt }}'"
when: "global_kernel_opt is defined"
9 changes: 6 additions & 3 deletions roles/maas/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,13 @@

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these changes in this commit? config_maas.yml existed before the addition of console=, yes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the end I will just squash all my commits together, but you are right, I will try to separate my commits better in order to do this review process easier.

- import_tasks: initialize_secondary_rack.yml

# Configure MAAS
- import_tasks: config_maas.yml

# Logging into the MAAS API to use CLI
- name: Get API key
command: maas apikey --username={{ maas_admin_username }}
when: inventory_hostname in groups['maas_region_rack_server']
tags:
- config_dhcp
- config_maas
- add_machines
- config_dns
- config_ntp
Expand All @@ -69,11 +67,15 @@
when: inventory_hostname in groups['maas_region_rack_server']
tags:
- config_dhcp
- config_maas
- add_machines
- config_dns
- config_ntp
- add_users

# Configure MAAS
- import_tasks: config_maas.yml

# Configure NTP Service
- import_tasks: config_ntp.yml

Expand Down Expand Up @@ -102,6 +104,7 @@
command: "maas logout {{ maas_admin_username }}"
tags:
- config_dhcp
- config_maas
- add_machines
- config_dns
- config_ntp
Expand Down
Loading