When we're logging inside of ansible, turning off ansi colors can
be nice. Especially inside of Zuul.
Change-Id: I719ebb106fbb31795cc02c9504507bdae607bcdd
In debugging why I631e3e3592a9be5c7da642cf34eec6d9758bf161 was not
rolling out to the zuul executors, I eventually found
/etc/facter/facts.d/ansible.json was present on a number of hosts and
effectively pinning the project-config checkout to an old reference.
Given the dates around file creation and the pinned change number, it
seems very likely something happened during the openstack->opendev
transition where some hosts had ansible run with a specific
project_config_ref set as a fact. Although the fact is now unset,
nothing will ever clear the old ansible.json which keeps applying.
We could remove all stale files by hand; but a) it's not clear where
it ran (although likely only hosts starting with z*) and b) we leave a
chance for it to happen again.
We could clear this after every puppet run; but it seems like this
role should leave the system largely in the state it ran puppet in.
Thus this clears out the file before the puppet run if no facts are
given. This should fix our immediate issue on all hosts.
Change-Id: I96adf4fb77f06b18fe73b6f10d1b07b7fe44385f
With newer versions of ansible, module arguments are assumed to
be strings unless otherwise specified. Our 'facts' argument is
expected to be a dictionary, so tell ansible that.
Without this, the argument will arrive as a string and be written
to the facter file inside string quotes. Facter will produce the
following error:
undefined method `each' for #<String:0x000000016ee640>
Change-Id: Iea626466d0920349f434f678fe2f71cbee259383
We keep a local copy of this file for operational purposes, but the
upstream one has grown a few things. Sync to make it easier to submit
our local changes upstream.
Change-Id: I84927750fce1a7c6101e8d5c131c0b13020bb6aa
We were copy pastaing code in the puppet cmd generation for noop and
environment handling. Collapse that to make code easier to read and
hopefully avoid future bugs where only one side is edited.
Local testing shows that puppet parses commands like:
puppet apply test.pp --noop
just fine.
Change-Id: Ie7665f72b9327b6b834d358699addf2c60a95ec0
check_mode causes other things that we may want to actually happen
(such as setting up hiera) not to run. This way we can do all of
those but still run puppet in noop.
Change-Id: I32f07a032d28f5c5d04e9eeb50b94f7c0a57ce53
puppet apply ignores the show-diff option.
Update the code so that both puppet apply and puppet agent
support the show-diff option.
Change-Id: I5b59b8ba8e50a44458d01ec97113a2ce313c1d9a
The --show-diff option to puppet agent is show-diff, not show_diff.
Also, there is a doc string about which version logdest was added in.
These are not important for Infra. However, keeping in sync makes it
easier to track changes that might actually matter.
Change-Id: Id16b9d7510efa4b8f3645997617cd00ee870e83a
So that we can upstream this, make the log output from the puppet
command configurable with a default value being what it was for us
before. As part of that, restore returning stdout and stderr even though
they'll be empty.
Depends-On: I22b1d0e1fb635f2c626d75a11764725c8753bf24
Change-Id: I245ac8c3533cce4a598909c03e1f2ba0f7b06850
Stop sending the complete puppet output back via json. Do send
it to local syslog instead.
This is mostly because right now all of our puppet output is going
into a single very long json line in our log file.
Change-Id: Ie6d2d82def95ef2bb79ae862707218a44e0138ca
The show_diff option is superseeded by a new built-in option in ansible
so does not need to be kept in the docs here.
Also, upstream needs the simplejson fallback. We do not, but keeping in
sync is easier.
Change-Id: I45a34614d08f4518f031c652915dae97cc3ccbed
The timeout command is there to improve life and workaround puppet
deficiencies. However, it's not working around deficiencies on systems
that do not have the timeout command if we blindly use it.
The puppet specific timeout options are more complex and out of scope of
this.
Issue: https://github.com/ansible/ansible-modules-extras/issues/1273
Change-Id: Id2afbe7a8d0a9b52295a36eb8bde4ffd40fa8c21
The puppet module is now upstream. We'll keep a copy here until we've
installed 2.0 everywhere. But for now, just sync with what is
currently upstream.
Change-Id: I4ffe174f733f9392fb420e304c1b2a02860f9c39
When we run puppet on the node, we may want to pass in parameters. There
are two different mechanisms that can be used for this, facter and
hiera. Allow users to pass in dictionaries of data containing key/value
pairs to either set ephemerally via facter environment variables, or
permanently by creating hiera files on disk so that subsequent runs will
keep those values.
Change-Id: Id99c3c2c20764ed4ba4259bd53f8067289374403