Skip to content

Commit

Permalink
refactor: revert to 6076e27
Browse files Browse the repository at this point in the history
We need to be able to generate README independentely of current play host.
In 6076e27 the list of host is read from files and not from inventory
  • Loading branch information
jobcespedes committed Aug 22, 2021
1 parent 80fa514 commit 412e658
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .ansible-ci/tasks/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
when: state_vars_dest_check is not defined
include_tasks: tasks/state/load.yml

- name: get container images from state dir
run_once: true
vars:
doc_get_ctr_names: "{{ lookup('pipe', 'find \"' + state_dir + '\" -maxdepth 1 -type f -name \"*.yml\" -print0 | sort -z | xargs -r0 basename -s .yml').split('\n') }}"
when:
- doc_ctr_names_from_state_dir | default(false)
- doc_get_ctr_names is defined and doc_get_ctr_names
set_fact:
doc_ctr_names: "{{ doc_get_ctr_names }}"

- name: generate project readme
run_once: true
when: doc_generate_project_readme | default(false)
Expand Down
3 changes: 2 additions & 1 deletion .ansible-ci/templates/README.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ This project builds containers using Ansible. The containers are defined as host
| Container Directory | Container Image | Version |
|---|---|---|
{% for ctr in doc_ctr_names | default(ansible_play_hosts,true) %}
| [{{ ctr }}]({{ ctr }}/ )| [{{ hostvars[ctr].state_yml_repo_digest.split('@')[0] }}](https://{{ hostvars[ctr].state_yml_repo_digest.split('@')[0] }}) | {{ hostvars[ctr].state_yml_tag }} |
{% set ctr_state = lookup('vars', ctr | replace('-', '_') | lower + '_image',default=False) %}
| [{{ ctr }}]({{ ctr }}/ )| [{{ ctr_state.repo_digest.split('@')[0] }}](https://{{ ctr_state.repo_digest.split('@')[0] }}) | {{ ctr_state.tag }} |
{% endfor %}

### How to build them?
Expand Down

0 comments on commit 412e658

Please sign in to comment.