-
Notifications
You must be signed in to change notification settings - Fork 138
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
fix: make sure binary install dir exists #423
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has now been migrated to the _common
role.
Can I just add the same change to every roles?
Or should I do something else? |
You can add a task to the install tasks file of the Adding this task before the last task, the one named "Propagate binaries", in - name: "Make sure binary install dir exists"
ansible.builtin.file:
path: "{{ _common_binary_install_dir }}"
mode: 0755
owner: root
group: root
become: true
tags:
- "{{ ansible_parent_role_names | first | regex_replace(ansible_collection_name ~ '.', '') }}"
- install
- "{{ ansible_parent_role_names | first | regex_replace(ansible_collection_name ~ '.', '') }}_install" |
8d36f92
to
86dac65
Compare
Thanks for the detailed explanation. I changed it according to your comment. |
mode: 0755 | ||
owner: root | ||
group: root |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we should be explicitly changing these permissions, given this is /usr/local/bin
by default.
For example, if this is a symlink, I'm pretty sure this will break the system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mode/owner has to be set because of https://nvd.nist.gov/vuln/detail/CVE-2020-1736
But I agree that we should use stat first to be on the safe side.
I think we should use ansible.bultin.stat as a preflight check, rather than actually try and create the target directory. |
86dac65
to
e7b7bd7
Compare
e7b7bd7
to
2fc5df0
Compare
- name: "Check existence of binary install dir" | ||
ansible.builtin.stat: | ||
path: "{{ _common_binary_install_dir }}" | ||
register: __common_binary_install_dir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote this with reference to below format:
ansible/roles/systemd_exporter/tasks/preflight.yml
Lines 42 to 50 in f3514a9
- name: Check existence of TLS key file | |
ansible.builtin.stat: | |
path: "{{ systemd_exporter_tls_server_config.key_file }}" | |
register: __systemd_exporter_key_file | |
- name: Assert that TLS key and cert are present | |
ansible.builtin.assert: | |
that: | |
- "__systemd_exporter_cert_file.stat.exists" |
2fc5df0
to
5e188a2
Compare
Can someone help me? I can't figure out how my
|
5e188a2
to
0ebd5ba
Compare
That issue is unrelated to your change, the docker ansible collection which is used for the tests was updated recently and that broke compatibility with old ansible versions. |
Signed-off-by: Namjae Kim <namjae.kim@namsic.dev>
0ebd5ba
to
99c72c8
Compare
Docs Build 📝Thank you for contribution!✨ This PR has been merged and the docs are now incorporated into |
I'm trying to install node_exporter on a remote host with a custom
node_exporter_binary_install_dir
.But when I ran the above playbook, I got the following result:
If there are multiple target hosts, it would be nice to automatically create the directory if it does not exist.
If these changes are not appropriate, please let me know.
Thanks.