Skip to content

Commit

Permalink
install host packages via user_data when creating instances
Browse files Browse the repository at this point in the history
  • Loading branch information
abikouo committed Dec 21, 2023
1 parent 3d8f72c commit 12a48c1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
7 changes: 0 additions & 7 deletions roles/deploy_flask_app/files/run_app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@
- regex: ^(# *)?ClientAliveCountMax
line: ClientAliveCountMax 3

- name: Install Podman
ansible.builtin.yum:
name:
- podman
update_cache: True
state: present

- name: Pull image from private registry
ansible.builtin.shell:
cmd: >
Expand Down
1 change: 1 addition & 0 deletions roles/deploy_flask_app/tasks/setup_bastion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
name: "{{ deploy_flask_app_bastion_host_required_packages }}"
state: present
become: true
when: deploy_flask_app_bastion_host_required_packages | length > 0

- name: Generate ssh configuration for current user
ansible.builtin.user:
Expand Down
6 changes: 6 additions & 0 deletions roles/deploy_flask_app/tasks/setup_infra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@
- "{{ deploy_flask_app__group_id }}"
wait: true
count: "{{ deploy_flask_app_expected_instances }}"
user_data: |
#cloud-config
package_upgrade: true
package_update: true
packages:
- podman
state: started
register: deploy_flask_app_workers
when: deploy_flask_app_expected_instances | int > 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@
- "{{ secgroup.group_id }}"
security_groups:
- "{{ secgroup.group_id }}"
user_data: |
#cloud-config
package_upgrade: true
package_update: true
packages: "{{ deploy_flask_app_bastion_cloud_config_packages }}"
wait: true
state: started
register: vm_result
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ image_filter: Fedora-Cloud-Base-37-*

deploy_flask_app_bastion_host_name: "{{ resource_prefix }}-bastion"
deploy_flask_app_bastion_host_username: fedora
deploy_flask_app_bastion_host_required_packages:
deploy_flask_app_bastion_host_required_packages: []
deploy_flask_app_bastion_cloud_config_packages:
- python3
- python-virtualenv
- sshpass
Expand Down

0 comments on commit 12a48c1

Please sign in to comment.