openshift-ansible.spec 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. # %commit is intended to be set by tito custom builders provided
  2. # in the .tito/lib directory. The values in this spec file will not be kept up to date.
  3. %{!?commit:
  4. %global commit c64d09e528ca433832c6b6e6f5c7734a9cc8ee6f
  5. }
  6. # This is inserted to prevent RPM from requiring "/usr/bin/ansible-playbook"
  7. # The ansible-playbook requirement will be ansibled by the explicit
  8. # "Requires: ansible" directive
  9. %global __requires_exclude ^/usr/bin/ansible-playbook$
  10. Name: openshift-ansible
  11. Version: 4.1.0
  12. Release: 0.0.0%{?dist}
  13. Summary: Openshift and Atomic Enterprise Ansible
  14. License: ASL 2.0
  15. URL: https://github.com/openshift/openshift-ansible
  16. Source0: https://github.com/openshift/openshift-ansible/archive/%{commit}/%{name}-%{version}.tar.gz
  17. BuildArch: noarch
  18. Requires: ansible >= 2.7.8
  19. Requires: python2
  20. Requires: python-six
  21. Requires: tar
  22. Requires: %{name}-docs = %{version}-%{release}
  23. Requires: %{name}-playbooks = %{version}-%{release}
  24. Requires: %{name}-roles = %{version}-%{release}
  25. Obsoletes: atomic-openshift-utils <= 3.10
  26. Requires: libselinux-python
  27. Requires: pyOpenSSL
  28. Requires: python2-openshift
  29. %description
  30. Openshift and Atomic Enterprise Ansible
  31. This repo contains Ansible code and playbooks
  32. for Openshift and Atomic Enterprise.
  33. %prep
  34. %setup -q
  35. %build
  36. %install
  37. # Base openshift-ansible install
  38. mkdir -p %{buildroot}%{_datadir}/%{name}
  39. mkdir -p %{buildroot}%{_datadir}/ansible/%{name}/inventory
  40. cp -rp inventory/dynamic %{buildroot}%{_datadir}/ansible/%{name}/inventory
  41. cp ansible.cfg %{buildroot}%{_datadir}/ansible/%{name}/ansible.cfg
  42. # openshift-ansible-bin install
  43. mkdir -p %{buildroot}%{_bindir}
  44. mkdir -p %{buildroot}%{python_sitelib}/openshift_ansible
  45. mkdir -p %{buildroot}/etc/bash_completion.d
  46. mkdir -p %{buildroot}/etc/openshift_ansible
  47. # Fix links
  48. rm -f %{buildroot}%{python_sitelib}/openshift_ansible/aws
  49. rm -f %{buildroot}%{python_sitelib}/openshift_ansible/gce
  50. # openshift-ansible-docs install
  51. # Install example inventory into docs/examples
  52. mkdir -p docs/example-inventories
  53. cp inventory/hosts.* inventory/README.md docs/example-inventories/
  54. # openshift-ansible-playbooks install
  55. cp -rp playbooks %{buildroot}%{_datadir}/ansible/%{name}/
  56. cp -rp test %{buildroot}%{_datadir}/ansible/%{name}/
  57. # BZ1330091
  58. find -L %{buildroot}%{_datadir}/ansible/%{name}/playbooks -name lookup_plugins -type l -delete
  59. find -L %{buildroot}%{_datadir}/ansible/%{name}/playbooks -name filter_plugins -type l -delete
  60. # openshift-ansible-roles install
  61. cp -rp roles %{buildroot}%{_datadir}/ansible/%{name}/
  62. # Base openshift-ansible files
  63. %files
  64. %doc README*
  65. %license LICENSE
  66. %dir %{_datadir}/ansible/%{name}
  67. %{_datadir}/ansible/%{name}/inventory
  68. %{_datadir}/ansible/%{name}/ansible.cfg
  69. # ----------------------------------------------------------------------------------
  70. # openshift-ansible-docs subpackage
  71. # ----------------------------------------------------------------------------------
  72. %package docs
  73. Summary: Openshift and Atomic Enterprise Ansible documents
  74. Requires: %{name} = %{version}-%{release}
  75. BuildArch: noarch
  76. %description docs
  77. %{summary}.
  78. %files docs
  79. %doc docs
  80. # ----------------------------------------------------------------------------------
  81. # openshift-ansible-playbooks subpackage
  82. # ----------------------------------------------------------------------------------
  83. %package playbooks
  84. Summary: Openshift and Atomic Enterprise Ansible Playbooks
  85. Requires: %{name} = %{version}-%{release}
  86. Requires: %{name}-roles = %{version}-%{release}
  87. BuildArch: noarch
  88. %description playbooks
  89. %{summary}.
  90. %files playbooks
  91. %{_datadir}/ansible/%{name}/playbooks
  92. # Along the history of openshift-ansible, some playbook directories had to be
  93. # moved and were replaced with symlinks for backwards compatibility.
  94. # RPM doesn't handle this so we have to do some pre-transaction magic.
  95. # See https://fedoraproject.org/wiki/Packaging:Directory_Replacement
  96. %pretrans playbooks -p <lua>
  97. -- Define the paths to directories being replaced below.
  98. -- DO NOT add a trailing slash at the end.
  99. dirs_to_sym = {
  100. "/usr/share/ansible/openshift-ansible/playbooks/common/openshift-master/library",
  101. "/usr/share/ansible/openshift-ansible/playbooks/certificate_expiry"
  102. }
  103. for i,path in ipairs(dirs_to_sym) do
  104. st = posix.stat(path)
  105. if st and st.type == "directory" then
  106. status = os.rename(path, path .. ".rpmmoved")
  107. if not status then
  108. suffix = 0
  109. while not status do
  110. suffix = suffix + 1
  111. status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
  112. end
  113. os.rename(path, path .. ".rpmmoved")
  114. end
  115. end
  116. end
  117. %package roles
  118. # ----------------------------------------------------------------------------------
  119. # openshift-ansible-roles subpackage
  120. # ----------------------------------------------------------------------------------
  121. Summary: Openshift and Atomic Enterprise Ansible roles
  122. Requires: %{name} = %{version}-%{release}
  123. Obsoletes: %{name}-lookup-plugins
  124. Obsoletes: %{name}-filter-plugins
  125. Obsoletes: %{name}-callback-plugins
  126. BuildArch: noarch
  127. %description roles
  128. %{summary}.
  129. %files roles
  130. %{_datadir}/ansible/%{name}/roles
  131. %pretrans roles
  132. #RHBZ https://bugzilla.redhat.com/show_bug.cgi?id=1626048
  133. #roles/openshift_examples/latest used to be a symlink, now its a dir
  134. # workaround for RPM bug https://bugzilla.redhat.com/show_bug.cgi?id=975909
  135. if [ -d %{_datadir}/ansible/%{name}/roles/openshift_examples/files/examples ]; then
  136. find %{_datadir}/ansible/%{name}/roles/openshift_examples/files/examples -name latest -type l -delete
  137. fi
  138. # ----------------------------------------------------------------------------------
  139. # openshift-ansible-tests subpackage
  140. # ----------------------------------------------------------------------------------
  141. %package test
  142. Summary: Openshift and Atomic Enterprise Ansible Test Playbooks
  143. Requires: %{name} = %{version}-%{release}
  144. Requires: %{name}-roles = %{version}-%{release}
  145. Requires: %{name}-playbooks = %{version}-%{release}
  146. Requires: python-boto3
  147. Requires: openssh-clients
  148. BuildArch: noarch
  149. %description test
  150. %{summary}.
  151. %files test
  152. %{_datadir}/ansible/%{name}/test
  153. %changelog