Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Selfhosted
  3. Ansible Playbook - How do I reverse engineer a running system?

Ansible Playbook - How do I reverse engineer a running system?

Scheduled Pinned Locked Moved Selfhosted
selfhosted
24 Posts 13 Posters 96 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • chrisp@cyberplace.socialC [email protected]

    @Cyber If you have some old wiki notes on how the system was setup originallythen it night be easier to ignore the current system and translate the wiki instructions into ansible. Still manual, but easier than reverse engineering. Another thing you can look at is bash history. Apart from backing up/cloning the system before you start I would also get a copy of the bash history for the various users and add it to a wiki or issue too. It will be useful.

    C This user is from outside of this forum
    C This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #21

    Yeah... notes... they started about 50% of the way through building the system.

    Now, my notes are great, but some of these devices are ~10 years old.

    But, yep, I totally agree, notes are a damn good thing to have.

    Not thought about bash history though, interesting point, but I think that only goes back a short duration?

    1 Reply Last reply
    0
    • chrisp@cyberplace.socialC [email protected]

      @Cyber Yeah it's gonna be pretty manual as others have mentioned. Some areas to look at:
      - Filesystem provisioning, mounts, etc.
      - Packages
      - Users, groups
      - Time zone, locale language, time format etc.
      - /etc/
      - /root/ and /home/
      - SSH settings
      - Services
      - Cron jobs/systemd timers

      There is a bit of overlap between some of those categories. Some bits are going to see more or less use on VMs vs physical. And remember that in ansible there are built in modules for a lot of functionality.

      C This user is from outside of this forum
      C This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #22

      Hadn't thought about all the locale, etc.... good point, thanks

      1 Reply Last reply
      0
      • bushvin@lemmy.worldB [email protected]

        I would copy the existing system onto a new system:

        1. Update system to the latest packages
        2. Create a new base system using the same distro
        3. Check which packages are not on the new system, add them to your playbook
        4. Install packages on new system
        5. This will take some time. Run a find of all files and pass them to md5sum or sha512sum to get a list of files with their checksum. Compare the list from the old system to the new system.
        6. Update your playbook with these findings. Template is probably the way to go, Lineinfile might be good as well, use copy if nothimg else works.
        7. Check firewall settings and update your playbook.

        Anyhow this will take some iterations, but while you have a copy of your ‘production’ system, you can test on your ‘test’ machine until you have the same functionality.

        W This user is from outside of this forum
        W This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #23

        oh the find with the hash sum is good advice! I would have done this but manually, maybe with the double commander sync dirs tool.

        but also, for configs this might be the best time to move your custom config to ordered dropin files for all things that support it.

        1 Reply Last reply
        0
        • C [email protected]

          I have a few VMs and PMs around the house that I'd setup over time and I'd now like to rebuild some, not to mention just simplify the whole lot.

          How the hell do I get from a working system to an equivalent ansible playbook without many (MANY) iterations of trial & error - and potentially destroying the running system??

          Ducking around didn't really show much so I'm either missing a concept / keyword, or, no-one does this.

          Pointers?

          TIA

          N This user is from outside of this forum
          N This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #24

          I went through this about 6 months ago.

          Just build playbooks from basic to specific. I did so in three parts:

          1. Container creation
          2. Basic settings common to all my hosts
          3. Specific service config & software

          Ansible assumes you have a hierarchy of roles to apply for each service, so layering playbooks this way should help

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups