Re: Upgrade automation

From: Cristian Cardoso <cristian.cardoso11_at_gmail.com>
Date: Wed, 11 May 2022 16:20:37 UTC
I create this playbook:


- name: Applying major version upgrade
   command: freebsd-update --not-running-from-cron upgrade -r {{ version }}
   become: yes
   tags:
   - freebsd-upgrade

- name: Apply update installation
   command: freebsd-update --not-running-from-cron install
   become: yes
   tags:
   - freebsd-upgrade

- name: Reboot after upgrade
   shell: "sleep 5 && reboot"
   async: 1
   poll: 0
   become: yes
   tags:
   - freebsd-upgrade


- name: Waiting for machine reboot (max 600s)
   wait_for_connection:
     connect_timeout: 20
     sleep: 20
     delay: 60
     timeout: 600
   tags:
   - freebsd-upgrade

- name: Running freebsd install userland
   command: freebsd-update --not-running-from-cron install
   become: yes
   tags:
   - freebsd-upgrade



But since the command doesn't support -y no -not-running-from-cron for the
upgrade command, I believe everything is stalling on this question and the
playbook has no proceeding and it stays on this question below:

The following components of FreeBSD do not seem to be installed:
world/base-dbg world/lib32-dbg

Does this look reasonable (y/n)?







Em ter., 10 de mai. de 2022 às 13:38, Miroslav Lachman <000.fbsd@quip.cz>
escreveu:

> On 10/05/2022 17:46, Alan Somers wrote:
> > On Tue, May 10, 2022 at 9:08 AM Cristian Cardoso
> > <cristian.cardoso11@gmail.com> wrote:
> >>
> >> Hi
> >>
> >> I have some FreeBSD servers in my machine park and I would like to
> perform the version upgrade in an automated way with ansible.
> >>
> >> In my example, I want to perform the upgrade from version 12.3 to 13,
> it is possible to run the upgrade with the command below:
> >>
> >> freebsd-update --not-running-from-cron upgrade -r 12.2-RELEASE
> >>
> >> I ask this, because I don't know if it's the most correct way to
> execute this.
> >>
> >> Grateful for any assistance.
> >
> > Yes, that's perfect.  But there's another step too.  You'll have to do:
> > freebsd-update install
> > And _this_ step isn't easy to perfectly automate, because etcupdate
> > may ask for your input when it merges config files.  If you know
> > exactly which etc files you've modified, you can add them to
> > IgnorePaths.  That way etcupdate won't run interactively, it will
> > simply throw away changes from upstream.
>
> Automation with etcupdate sounds very scary to me because etcupdate
> breaks real life configuration files inplace. Mergemaster did it on
> temporary copies. But if you let etcupdate to left something (after
> merge conflict) in vital config file(s) wich will have syntax error on
> next boot, then you are out.
> It would be much better if etcupdate do not edit target file on merge
> conflicts.
>
> Kind regards
> Miroslav Lachman
>