-
Notifications
You must be signed in to change notification settings - Fork 130
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 #22842 - Create .ansible.cfg in /etc/foreman-proxy #415
Conversation
@dLobatog, the Redmine ticket used is for a different project than the one associated with this GitHub repository. Please either:
If changing the ticket number used, remember to update the PR title and the commit message (using This message was auto-generated by Foreman's prprocessor |
I feel state should not live in |
I ran into this problem and I think the only way to work around this differenlty would be to make /usr/share/foreman-proxy writable for the proxy user or to bring the ~/.ansible dir via packaging. |
The actual directory is in |
In vanilla foreman we create files in |
@dLobatog could you check the vanilla ansible.cfg for file that are put into ~/.ansible per default and add configuration to put these into e.g ./var/lib/foreman-proxy/ansible. That should fix the original problem differently. |
Thinking about it again, having ~foreman-proxy/.ansible linked to e.g. /var/lib/foreman-proxy/ansible makes indeed more sense... |
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 still think we should never write in /usr
and including it in the installer is wrong.
manifests/plugin/ansible.pp
Outdated
@@ -38,6 +38,12 @@ | |||
template_path => 'foreman_proxy/plugin/ansible.yml.erb', | |||
} | |||
|
|||
file { '/usr/share/foreman-proxy/.ansible': |
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.
Like @mmoll said, this should be "${::foreman_proxy::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.
as @lpramuk mentioned we also need .ansible_galaxy for jobs that install roles from galaxy
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.
~foreman-proxy/.ansible
~foreman-proxy/.ansible_galaxy
we need both, the latter is for galaxy jobs
@dLobatog, the Redmine ticket used is for a different project than the one associated with this GitHub repository. Please either:
If changing the ticket number used, remember to update the PR title and the commit message (using This message was auto-generated by Foreman's prprocessor |
@dLobatog, the Redmine ticket used is for a different project than the one associated with this GitHub repository. Please either:
If changing the ticket number used, remember to update the PR title and the commit message (using This message was auto-generated by Foreman's prprocessor |
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.
manifests/params.pp
Outdated
$shell = '/bin/false' | ||
$user = 'foreman-proxy' | ||
$dir = '/usr/share/foreman-proxy' | ||
$var_dir = '/var/lib/foreman-proxy' |
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 should be set for every OS.
manifests/plugin/ansible.pp
Outdated
@@ -19,13 +19,17 @@ | |||
Stdlib::Absolutepath $ansible_dir = $::foreman_proxy::plugin::ansible::params::ansible_dir, | |||
Optional[Stdlib::Absolutepath] $working_dir = $::foreman_proxy::plugin::ansible::params::working_dir, | |||
) inherits foreman_proxy::plugin::ansible::params { | |||
file {"${::foreman_proxy::dir}/.ansible.cfg": | |||
file {"${::foreman_proxy::var_dir}/ansible.cfg": |
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.
Should this be in the etc dir instead since it's config, not state?
1cdf94f
to
c6518ec
Compare
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.
@ekohl Thanks for the review, I have set $var_dir
for all OSs now, and also moved ansible.cfg
to live in /etc/foreman-proxy/ansible.cfg
as it's config. Once this is merged I'll have to update the docs to reflect the changes.
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.
We should probably also fix these things in packaging.
manifests/plugin/ansible.pp
Outdated
ensure => file, | ||
content => template('foreman_proxy/plugin/ansible.cfg.erb'), | ||
owner => 'root', | ||
group => $::foreman_proxy::user, | ||
mode => '0640', | ||
} | ||
~> file { "${::foreman_proxy::dir}/.ansible.cfg": | ||
ensure => link, | ||
target => "${::foreman_proxy::etc}/ansible.cfg", |
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 should include /foreman-proxy
like on line 22.
manifests/plugin/ansible.pp
Outdated
@@ -38,6 +42,26 @@ | |||
template_path => 'foreman_proxy/plugin/ansible.yml.erb', | |||
} | |||
|
|||
file { "${::foreman_proxy::var_dir}/ansible": |
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 var_dir
isn't created by packaging. It may be best to ensure that in foreman_proxy::config
so all plugins can rely on it.
Updated to make sure @ekohl What exactly do you have in mind to fix in packaging? |
@dLobatog I think ensuring those directories and symlinks exist is something we should fix in packaging. It's also a better place to migrate any existing data. We'll still need to modify the etc directory here so that still makes sense. |
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.
@ekohl Is there anything missing here? The var_dir
is created in foreman_proxy::config
, however if packaging creates it, the installer would just skip the creation and it's just a check that the file exists and has the correct owner.
4245535
to
f4f9da3
Compare
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.
Tests are green now
Do we need to migrate any existing data? This could be done in |
I think the opposite aproach was requested |
Right, sorry - somehow I missed they are symlinks last night 👍 |
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.
Anything else missing here? @ekohl
theforeman/foreman-packaging#2348 should simplify this. With that you only need to change I'll also have a look at a comparable Debian packaging change. |
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.
@ekohl Alrighty, I've moved it to include only the /etc/ change. Everything else is saved in a branch 22842-backup in case we need to use it at some point.
Currently we just mention it in the documentation https://github.com/theforeman/theforeman.org/pull/1033/files
but the installer should do this. The directory is used for some Ansible
tmp files