motd generic template added #2418
No reviewers
Labels
No labels
freeze-break-request
post-freeze
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Infrastructure/ansible#2418
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "motd"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
motd.j2
underroles/base
.templates/system_identification
still references about CSI stuffs in the last 2 lines (let me know what should I update it with?)Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/737b1f55fc3743f1956301ce68c7af00
So yeah, those 2 bottom lines are going to be the tricky/time consuming part.
Currently it gets those from the hosts repo (which we want to retire). So, ideally we would look at the hosts repo, ignore anything that is 'phx2' (thats our old datacenter), and copy the notes for each host that is still a valid host into ansible/inventory/host_vars/hosname as a 'notes: ' variable. Or perhaps it would be better as 'motd_notes: '.
The system_identification.j2 template in the hosts repo is a bit of discussion point, we don't want to point to CSI or use it's stuff, but there's still possibly useful things there. I guess for now, I'd say drop all the variables that are csi_* and so keep, freezes, and env.
So, Could you make a small script that does that and then add the changes to this PR?
Let me know if that does or does not make sense. ;)
so, I should create a script that lists the directory that are not
phx2
frominfra/hosts
And compares the directories withansible/inventory/host_vars
, if the dir matches, create a variable namedmotd_notes
in yaml files, write the notes content into it and save it. do it for each hostnames that is valid and matches withhost_vars
.okay, I'll drop any CSI* related stuffs from the file and keep the
freeze
,env
...and so on.am I correct?
Is it okay to write the path that is
/srv/infra/hosts/*
to access the files fromansible
repo in the script?Or is there any other way to mention the path of dir? (vars, alias.....anything?) rather than mentioning the absolute path?
Nope, we don't want to refer to hosts repo at all in the end...
I was suggesting a one-off script to move things from hosts to ansible repo... ie, just create a script to do the work, and add the changes here (we don't need the script after that, it's just run once).
Does that make sense?
um...how do i specify the location of the
hosts
directory?I understand it's a "one-time use" script, but the "
hosts
" located in a different directory right, how can this script access the directory that is outside of it's own location?we're basically moving things from
infra/hosts/(match+valid hostnames)
toanisble/inventory/host_vars/(match+valid hostname)
correct?the script can access the elements from this repo, but how does it access a directory that is outside the repo?
The one-time script doesn't need to be added to ansible repo at all. You can make it in your homedir on batcave01 and just refer to /srv/web/infra/hosts/ directory directly... then the output you can copy down locally and add to the pr?
I'm probibly not explaining things well... sorry for any confusion...
oh, thanks for explaining that :D
so, I'll create a script that compares the dirnames from
ansible/inventory/host_vars
toinfra/hosts
(!phx2)only the valid directory's "notes" will be copied into my home directory.
at last, I'll create a variable named "motd_notes" under each valid hostname's yaml file and add the notes content there.
Then I'll make a PR.
did I get that right?
um...I didn't used any scripts, it seems a bit complex for me, idk how to do it on servers.
So I ended up doing the tasks manually,
infra/hosts
only these 2 hosts have contents that can copied
is that okay, can I make a PR for that?
matched + valid hostnames with no contents in
notes
:(count: 13)
these hostnames contains either the "No notes found.." text or no
notes
file found in them.matched + valid hostnames with contents in
notes
:so out of 169 hostnames from
infra/hosts
only 2 hostnames havenotes
contents that can be copied to the "matched" hostnames inansible/inventory/host_vars
.1 new commit added
migrated notes from infra/hosts
Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/ec61c7b2e40f4ba19671759740cbc756
Wow. I thought there would be more. ;)
I guess that shows how out of date that hosts repo is. ;)
So, next steps then:
The roles/base/motd.j2 you have here needs adjsted to work in the base role.
The includes need adjusted. You can drop the system_identification include, since thats all the CSI stuff we arent including.
Theres a few things from the old system_identification template that aren't CSI that we could also include:
Environment: {{env}}
Freezes: {{freezes}}
There's also a bunch of csi_ variables in group vars in ansible. Perhaps we could delete those and perhaps rename some. I think the csi_propose could perhaps just be converted into notes: ?
and the rest deleted.
Let me know if that makes sense... and sorry for the delay getting back to you.
The notes are no longer including a file, but using a variable, so you probibly want something like:
{{ hostvars[inventory_hostname][notes] }}
okay, so I will remove the "include" for the "
system_identification
"and replace it with the variables
{env} & {freezes}
I mostly see these 4 variables in the inventory group_vars:
so I will delete these vars:
csi_primary_contact
csi_relationship
then I'll convert the
csi_purpose
intonotes
for the respective group var?so I was deleting the all the other vars except
csi_purpose
I think we can also make "notes" for
csi_relationship
as well?that var explains some stuffs related to group_var...idk
should we just keep only the
csi_purpose
to provide context about what's happening?or we can keep both
csi_purpose
&csi_relationship
with the context & explanation as well?Yes, that was exactly right. ;)
Hum... I suppose we could merge csi_relationship and csi_purpose into notes. We can always adjust notes afterwards. So sure...
2 new commits added
removed csi_* vars from group_vars; converted csi_purpose & csi_responsibility into notes
motd changes; excluding CSI infos
Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/2cc9b1337fae4ba9872873fc66cd73e8
4 new commits added
removed csi_* vars from group_vars; converted csi_purpose & csi_relationship into notes
motd changes; excluding CSI infos
migrated notes from infra/hosts
motd generic template added
Merge Failed.
This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging pagure.io/fedora-infra/ansible for 2418,3dea3697de5f4e58248ea1fb8ae3eb35f9350506
the current branch im working on is like 8 days old...should i pull the upstream and rebase...then push the changes?
rebased onto
47c68f478d
Merge Failed.
This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging pagure.io/fedora-infra/ansible for 2418,76507df3225bceba862b0f58439e647df27757e0
1 new commit added
fixed merge conflicts
Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/473130fb586444928e42ffb1dce89e38
phew...at last it works!
actually, there a conflict btw
i updated it by keeping the upstream changes and pushed it!
let me know if this fix is okay, as I have made another commit for that!
Yep. I changed that after your orig work so thats fine.
Getting really close! :)
2 last things.
Why are two of them 'motd_notes' and not just 'notes' ?
And the motd template has '+ {% include inventory_hostname + '/notes' ignore missing %}' but that wont work as these are not files to be included, but variables... so change to just "{{ notes }}" ?
ah those two....they were copied from the
infra/hosts
I cross-checked hostnames from
infra/hosts
toansible/inventory/host_vars
and copied them manually. so I named them like that...but I'll change it npas for
notes
, those were already present insidegroup_vars
under 2 different variable, I just converted two vars into one var (notes
) like you saidalrigth...remove that line and replaced it with
Notes: {{ notes}}
1 new commit added
minor changes; var
Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/0e6f58d7a35c4e14a14b312686fcbd5b
Looks good... and sorry to keep piling things on here, but... one (hopefully last) thing:
Right now, we have a tasks/motd.yml task that uses the old hosts template. Can you drop the:
tasks:
from all the playbooks that use it and replace it with a roles/base/tasks/motd.yml that copies the roles/base/templates/motd.j2 instead of the hosts one?
Then roles/base/tasks/main.yml will need to include motd.yml (just look at the other split out roles there).
Then, I sure hope it will be done. :) Thanks for being so responsive here.
ah...
motd.yml
intasks/
so I'll create one that copies fromroles/base/motd.j2
.motd.j2
is inroles/base/motd.j2
should I move it insidetemplates
? like you mentioned?(ill move it inside & push the changes, let me know I'll have to move it back :P)
as for the
roles/base/template/motd.yml
, i essentially followed the same oldtasks/motd.yml
and just changed the locations....i hope
dest=/etc/motd
is fineso basically....I'll have to replace the "
tasks_path
" with the actual path of themotd.yml
right?if so...then it would be smthg like this:
am i correct?
or do i have to mention the absolute path of the motd.yml?
perhaps we could create a new variable for that in
/vars/global.yml
something like:
also I can see another variable
so I could use it like
is that okay?
I updated all the playbooks to go with this location is that okay?
so far...
motd.yml
inroles/base/tasks
and point toroles/base/template/motd.j2
hope i did correctly?
also updated the
main.yml
to includemotd.yml
(i saw the other "imports" and essentially followed the same way)
1 new commit added
updating YAMLs & playbooks
Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/5f910ec15d554253b27124c0c2babdc1
I honestly don't know why it's failing.
So I went back few previous commits, switched to main branch, and it's still not works.
(i may have debugged it incorrerctly, so let me mention what I did)
playbooks/groups/backup-server.yml
'ansible-lint
I still ended up getting the same error output...
We only got ansiblelint working on things a few months ago, so there's a lot of old legacy things that need fixing.
So, I think perhaps I confused you here. :(
I was suggesting:
Remove entirely the - import_tasks: "{{ tasks_path }}/motd.yml" from playbooks. We are moving it from being that seperate task to just being part of the base role, so it doesn't need to be there at all anymore.
You can remove entirely the tasks/motd.yml file too.
In the roles/base/tasks/motd.yml for the template call, you don't need to specify any path, just 'src=motd.j2' Ansible will look in the templates dir for that role first to find it. :)
Aside that this looks pretty close. Can you make those changes and then we can see about the lint stuff?
Thanks again for working on this!
hmm...hmm, removed that line from all the playbooks.
yup, deleted that file!
oh I understand, now it only contains
src=motd.j2
1 new commit added
udpated YAMLs & playbooks again
Merge Failed.
This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging pagure.io/fedora-infra/ansible for 2418,19c212f9296722d72c19464ae591977603fb755a
1 new commit added
updated correctly; buildhw.yml
Merge Failed.
This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging pagure.io/fedora-infra/ansible for 2418,bac2873637808274b180a4f65628fb36d4e76208
rebased onto
a0720a8029
Merge Failed.
This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging pagure.io/fedora-infra/ansible for 2418,94f49e7b7f80e36624cd7a49b8bc73735227a4a6
1 new commit added
fixing merge conflicts
Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/09f53cf05e0b44d69eccc44ae8625c70
i fixed the merge conflicts and now we're back to the
fi-ansible-lint-diff
failure :(how are we going to fix that?
i would say, thanks for guiding me even if im making a lot of mistakes here :)
@ryanlerch was looking at these lint issues. We can also just ignore them for this pr (since they have been this way a long time).
(lets see what he says)
Otherwise, you do need 'dest=/etc/motd' in the template call. :) I meant that src can just be motd.j2, but it still needs to know where to copy it to. ;)
yes, will do it right away!
1 new commit added
dest added in motd.yml
Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/135a4ba0455a42d593b7cf6de9a8feec
@kevin now that we have updated from
infra/hosts
toinfra/ansible/
.what information are we going to replace with in the current Infrastructure Apprentice page?
should we start a discussion threat? or send mailing lists?
yk, you mentioned that we could start sending mailing lists or creating discussion threat on or after new year?
I think it's about time we get started with this?
So, looks like there are conflicts here now. ;( Can you rebase? I suspect it's ryan's lint changes touched things in this...
Also, can you perhaps squash the 11 commits here into 1?
(git rebase -i HEAD~11 should allow you do it.)
On the apprentice stuff... thats pretty unrelated here. Lets talk on matrix first and figure out where and what we want to discuss first?
rebased onto
588dc2af21
Merge Failed.
This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging pagure.io/fedora-infra/ansible for 2418,d6ba72075ba2b7c5168267f82995d3d2d631fae5
i have resolved the merge conflicts by updating it with the upstream changes, it still failing
yes, I have squashed it too
alright!
@kevin
I have resolved the conflicts and squased the commits as well
finally pushed the changes
but its still failed?
i don't know which one is causing this?
is there a way to backtrace the issue?
i can't see any logs in zuul either, can you help me with that?
rebased onto
a6c874f45e
Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/380cde7f893741188c8f9d1642358c39
I have rebased it once again, and now its seems to be working fine!
could you please review this PR?
@kevin
rebased onto
85ecf47a2a
Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/c105c54d47a3490b8287af9e1856ac2e
rebased onto
7799cc2478
rebased onto
7799cc2478
Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/fa0f8fb7542a4e34b679c204b4868020
ok. I think everything should be addressed. ;) Lets give it a go...
and thanks so much for working through all the feedback.
Pull-Request has been merged by kevin
yup, thanks for guiding me as well :)