3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ansible : AIX モジュールの確認 - mksysb

Last updated at Posted at 2020-04-09

Ansible AIX 検証 : mksysb モジュール

Ansible の mksysb (システム・バックアップ取得) モジュールの稼働を確認しました。

実行環境

Ansibleサーバー :

  • CentOS 7.6.1810 (Core)
  • Python 2.7.5
  • ansible 2.8.2

実行対象のAIXサーバー:

  • AIX 7.2 TL4 SP01
  • Python 2.7.15

playbook

実行内容:
・aix_filesystemモジュールでファイルシステム拡張
・mksysbモジュールでmksysb取得 
 /home下に ansibletest_mksysb という名前のmksysbを取得します

aix_mksysb.yml

---
- hosts: all

  tasks:
# change filesystem
  -
    when: ansible_distribution == 'AIX'
    block:
    - aix_filesystem: { filesystem: "/",     size: "1G" }
    - aix_filesystem: { filesystem: "/var",  size: "2G" }
    - aix_filesystem: { filesystem: "/usr",  size: "4G" }
    - aix_filesystem: { filesystem: "/home", size: "3G" }

# create mksysb
    - name: Running a backup image mksysb
      mksysb:
        name: ansibletest_mksysb
        storage_path: /home
        exclude_files: yes
        exclude_wpar_files: yes

実行

$ time ansible-playbook -i ip -u root --private-key=id_rsa --ssh-common-args='-o StrictHostKeyChecking=no' -e ansible_python_interpreter=auto_silent ./playbooks/aix_mksysb.yml

PLAY [all] ***********************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************
changed: [192.168.0.xx]

TASK [aix_filesystem] ************************************************************************************************************
changed: [192.168.0.xx]

TASK [aix_filesystem] ************************************************************************************************************
changed: [192.168.0.xx]

TASK [aix_filesystem] ************************************************************************************************************
changed: [192.168.0.xx]

TASK [aix_filesystem] ************************************************************************************************************
changed: [192.168.0.xx]

TASK [Running a backup image mksysb] *********************************************************************************************
changed: [192.168.0.xx]

PLAY RECAP ***********************************************************************************************************************
192.168.0.xx               : ok=7    changed=6    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0


real	12m10.359s
user	0m25.143s
sys	0m6.169s

mksysb 取得のため12分ほど実行に時間がかかっています。

AIXサーバーでの確認

$ ssh -i id_rsa root@192.168.0.xx
Last login: Thu Apr  9 05:43:46 CDT 2020 on ssh from xx.xx.xx.xx
*******************************************************************************
*                                                                             *
*                                                                             *
*  Welcome to AIX Version 7.2!                                                *
*                                                                             *
*                                                                             *
*  Please see the README file in /usr/lpp/bos for information pertinent to    *
*  this release of the AIX Operating System.                                  *
*                                                                             *
*                                                                             *
*******************************************************************************
# oslevel -s
7200-04-01-1939
#
# df -g
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4           1.00      0.96    5%     2652     2% /
/dev/hd2           4.00      1.99   51%    36788     8% /usr
/dev/hd9var        2.00      1.96    2%      990     1% /var
/dev/hd3           0.22      0.22    2%       36     1% /tmp
/dev/hd1           3.00      0.59   81%        8     1% /home   
/dev/hd11admin      0.12      0.12    1%        5     1% /admin
/proc                 -         -    -        -      - /proc
/dev/hd10opt       0.38      0.04   90%    11484    53% /opt
/dev/livedump      0.25      0.25    1%        4     1% /var/adm/ras/livedump
/ahafs                -         -    -       35     1% /aha
/dev/repo00        7.31      0.03  100%     2533    25% /usr/sys/inst.images

-> "/ " が 1GB、"/usr" が 4GB、"/var" が 2GB、"/home" が 3GB に拡張されています。

# ls -l /home
total 5043408
-rw-r--r--    1 root     system   2582220800 Apr 09 05:41 ansibletest_mksysb
drwxr-xr-x    2 guest    usr             256 Nov 12 14:21 guest
drwx------    2 root     system          256 Jan 27 16:00 lost+found
drwxr-xr-x    2 srvproxy system          256 Jan 27 16:09 srvproxy
#

-> "/home" 下に "ansibletest_mksysb" ファイルが作成されています。

mksysb ファイルの中身を見てみます。

# cd /home
# restore -Tvf ansibletest_mksysb
Please mount volume 1 on ansibletest_mksysb
... and press Enter to continue

New volume on ansibletest_mksysb:
 Cluster 51200 bytes (100 blocks).
    Volume number 1
    Date of backup: Thu Apr  9 05:40:44 CDT 2020
    Files backed up by name
    User root
        6134 ./bosinst.data
          11 ./tmp/vgdata/rootvg/image.info
       10685 ./image.data
      217564 ./tmp/vgdata/rootvg/backup.data
           0 ./usr
           0 ./usr/X11R6
          19 ./usr/X11R6/lib
           8 ./usr/adm
           0 ./usr/aix
           0 ./usr/aix/bin
       40783 ./usr/aix/bin/cancel
       41671 ./usr/aix/bin/lp
       41243 ./usr/aix/bin/lpq
       42735 ./usr/aix/bin/lpr
       41671 ./usr/aix/bin/lprm
       43463 ./usr/aix/bin/lpstat

〜 以下省略 〜

rootvg バックアップが取得されています。

以上です。


参考
・Ansible : mksysb – Generates AIX mksysb rootvg backups
https://docs.ansible.com/ansible/latest/modules/mksysb_module.html
・Ansible : aix_filesystem – Configure LVM and NFS file systems for AIX
https://docs.ansible.com/ansible/latest/modules/aix_filesystem_module.html

・AIX7.2 : システム・バックアップのクローン作成
https://www.ibm.com/support/knowledgecenter/ja/ssw_aix_72/install/clone_sys_backup.html
・AIX7.2 : mksysb コマンド
https://www.ibm.com/support/knowledgecenter/ja/ssw_aix_72/m_commands/mksysb.html
・AIX7.2 : restore コマンド
https://www.ibm.com/support/knowledgecenter/ja/ssw_aix_72/r_commands/restore.html

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?