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

fixes/aws: save state #13

Merged
merged 2 commits into from
May 2, 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
57 changes: 29 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,36 @@ jobs:
run: |
ansible-lint ./

molecule:
name: Molecule
runs-on: ubuntu-latest
strategy:
matrix:
include:
- distro: centos7
playbook: converge.yml
- distro: debian10
playbook: converge.yml
# Disabled while it is correctly setup.
# molecule:
# name: Molecule
# runs-on: ubuntu-latest
# strategy:
# matrix:
# include:
# - distro: centos7
# playbook: converge.yml
# # - distro: debian10
# # playbook: converge.yml

steps:
- name: Check out the codebase.
uses: actions/checkout@v2
with:
path: 'mtulio.cloud_load_balancer'
# steps:
# - name: Check out the codebase.
# uses: actions/checkout@v2
# with:
# path: 'mtulio.cloud_load_balancer'

- name: Set up Python 3.
uses: actions/setup-python@v2
with:
python-version: '3.x'
# - name: Set up Python 3.
# uses: actions/setup-python@v2
# with:
# python-version: '3.x'

- name: Install test dependencies.
run: pip3 install ansible molecule[docker] docker
# - name: Install test dependencies.
# run: pip3 install ansible molecule[docker] docker

- name: Run Molecule tests.
run: molecule test
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
MOLECULE_DISTRO: ${{ matrix.distro }}
MOLECULE_PLAYBOOK: ${{ matrix.playbook }}
# - name: Run Molecule tests.
# run: molecule test
# env:
# PY_COLORS: '1'
# ANSIBLE_FORCE_COLOR: '1'
# MOLECULE_DISTRO: ${{ matrix.distro }}
# MOLECULE_PLAYBOOK: ${{ matrix.playbook }}
26 changes: 8 additions & 18 deletions tasks/aws-lb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,6 @@
retries: 3
delay: 5

- name: LB | AWS | Save config | Name
ansible.builtin.set_fact:
cluster_state: "{% set x = cluster_state.loadbalancers.__setitem__(lb.openshift_id + '_name', lb_out.load_balancer_name) %}{{ cluster_state }}"
when: lb.openshift_id is defined

- name: LB | AWS | Save config | Provider's DNS record
ansible.builtin.set_fact:
cluster_state: "{% set x = cluster_state.loadbalancers.__setitem__(lb.openshift_id + '_dns_provider', lb_out.dns_name) %}{{ cluster_state }}"
when: lb.openshift_id is defined

- name: LB | AWS | Set config | Custom DNS record
ansible.builtin.set_fact:
cluster_state: "{% set x = cluster_state.loadbalancers.__setitem__(lb.openshift_id + '_dns', lb.register_dns[0].record) %}{{ cluster_state }}"
when:
- lb.openshift_id is defined
- lb.register_dns is defined
- lb.register_dns | length > 0

- name: LB | AWS | Show resources created
ansible.builtin.debug:
var: lb_out
Expand All @@ -114,3 +96,11 @@
ansible.builtin.debug:
var: rec_out
when: debug | d(false)

- name: AWS | Update Global states
ansible.builtin.set_fact:
cloud_loadbalancers_state: "{{ cloud_loadbalancers_state | d([]) + [_lb_data] }}"
vars:
_lb_data:
state: "{{ lb_out }}"
dns_records: "{{ rec_out }}"