Skip to content
This repository has been archived by the owner on Dec 26, 2020. It is now read-only.

Dependency flag #177

Merged
merged 9 commits into from
Aug 21, 2018
Merged

Dependency flag #177

merged 9 commits into from
Aug 21, 2018

Conversation

jcheroske
Copy link
Contributor

I looked at your mysql role, and named the flag based on that naming convention.

The big issue with what I just submitted is that the ssh restart handler doesn't work without adding become: yes directly to it. Ansible seems like a mass of bugs when it comes to using notify with other constructs like become or include or whatever. If you mess around with it and figure out a way to get a become: yes set on the include_role to propagate all the way to the handler, I would love to see that. I'm on Ansible 2.6.2 and it still doesn't work right for me. The docs discuss limitations with using include_*, but they are not as detailed as I would like.

Other than that issue, which may be of no consequence to you, this works perfectly.

Copy link
Member

@rndmh3ro rndmh3ro left a comment

Choose a reason for hiding this comment

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

Looks good! I've requested some minor adjustments.

@@ -1,3 +1,4 @@
- name: restart sshd
service: name={{ sshd_service_name }} state=restarted
when: "(ssh_server_enabled|bool)"
become: yes
Copy link
Member

Choose a reason for hiding this comment

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

Adding become: yes to the playbook fixes this, so I'd rather not have this here, as mentioned here: #81

Copy link
Contributor Author

@jcheroske jcheroske Aug 20, 2018

Choose a reason for hiding this comment

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

Man, this is such a sucky bug. I don't want to run my roles as root, so I don't use become: yes at the playbook level. It's supposed to be fixed, so that you can do an import_role and put the become: yes on that, but it doesn't work correctly. I think it would work, if there were no include_role calls between the import and the calling of the handler, but my implementation uses an include. That's why I put the become on the handler itself. I can take it off, but it means I'm still going to have to fork to get it working for me. Not a huge deal, but not ideal.

Copy link
Member

Choose a reason for hiding this comment

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

You're right. Let's keep it in for now and see if someone's got a problem with it.

tasks/main.yml Outdated
- name: include selinux specific tasks
include_tasks: selinux.yml
when: sestatus.rc == 0
- include_tasks: main_2.yml
Copy link
Member

Choose a reason for hiding this comment

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

Can you call this file hardening.yml?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Np

tasks/main.yml Outdated
include_tasks: selinux.yml
when: sestatus.rc == 0
- include_tasks: main_2.yml
when: ssh_hardening_enabled | default(true)
Copy link
Member

Choose a reason for hiding this comment

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

Please add the variable to the defaults.yml and into the documentation. It should be true.
Then please remove | default(true) from this condition.
I don't want any undocumented and undefined variables in the code.

@rndmh3ro rndmh3ro merged commit 8e6ff59 into dev-sec:master Aug 21, 2018
@rndmh3ro
Copy link
Member

Thanks @jcheroske !

@jcheroske
Copy link
Contributor Author

jcheroske commented Aug 21, 2018

@rndmh3ro You're welcome! And thank you for such an awesome set of roles!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants