0

I have simple play book for Solaris

- name: root access test
  hosts: solaris
  serial: "10"
  tasks:
   - name: Make nfs mount on a remote server
     become: yes
     delegate_facts: True
     shell:  mount -F nfs -o vers=3,soft,timeo=10  10.0.0.2:/export/store /media/nas 
     args: 
      executable: /bin/bash
~# zoneadm  list -cv
  ID NAME             STATUS     PATH                           BRAND    IP    
   0 global           running    /                              ipkg     shared
   1 myzone             running    /rpool/zones/myzone              ipkg     excl  

It working fine until you are in a global zone But now I need to execute the same playbook inside Solaris zone I don't have direct access to the zone over ssh I can only do:

  1. ssh to solaris@box
  2. solaris@box:~# sudo su -
  3. root@box:~# zlogin myzone
  4. root@myzone:~# mount -F nfs -overs=3,soft,timeo=10 10.0.0.2:/export/store /media/nas

Execute this command list inside a zone by using Ansible. Anyone has any experience with zone working before? Please share.

  • You appear to have root access to the system. Just set up `sshd` in the zone and `ssh` directly to the zone's by its hostname or IP address. – Andrew Henle Aug 14 '19 at 19:04
  • yes that will be easy solution & in that case I will not post my question here on a forum. The problem with that zone network it's not routable. – user2784340 Aug 14 '19 at 19:42
  • So modify the zone's network configuration so it's routable, or give it a routable IP address. – Andrew Henle Aug 15 '19 at 11:40
  • Try zlogin's non-interactive mode. Become an administrator in the global zone and then run `zlogin myzone mount -F nfs -overs=3,soft,timeo=10 10.0.0.2:/export/store /media/nas` – Mark Plotnick Aug 28 '19 at 15:09

1 Answers1

0

Create and Configure Zone in Solaris 11 create ansible playbook step wise
"1. Create ZFS File system : zfs create rpool/zone1 2. Configure a new Zone zone1 : zonecfg -z zone1 3. Install Zone zone1 4. zoneadm -z zone1 install 5 . Boot the Zone : zoneadm -z zone1 boot 6. Access Zone Console : zlogin -C zone1 a) System Configuration Tool b) Set Computer Name : zone1 c)Network Configuration : net0 d) Network Configuration Method : static "

sagar
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 27 '23 at 00:40