1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801
|
---
layout: default
built_from_commit: d0ec909330b5a98b868eae9a4aae37bbfca96e7a
title: Resource Type Reference (Single-Page)
canonical: "/puppet/latest/type.html"
toc_levels: 2
toc: columns
---
# Resource Type Reference (Single-Page)
> **NOTE:** This page was generated from the Puppet source code on 2024-09-30 11:26:40 -0700
## About resource types
### Built-in types and custom types
This is the documentation for Puppet's built-in resource types and providers. Additional resource types are distributed in Puppet modules.
You can find and install modules by browsing the
[Puppet Forge](http://forge.puppet.com). See each module's documentation for
information on how to use its custom resource types. For more information about creating custom types, see [Custom resources](/docs/puppet/latest/custom_resources.html).
> As of Puppet 6.0, some resource types were removed from Puppet and repackaged as individual modules. These supported type modules are still included in the `puppet-agent` package, so you don't have to download them from the Forge. See the complete list of affected types in the [supported type modules](#supported-type-modules-in-puppet-agent) section.
### Declaring resources
To manage resources on a target system, declare them in Puppet
manifests. For more details, see
[the resources page of the Puppet language reference.](/docs/puppet/latest/lang_resources.html)
You can also browse and manage resources interactively using the
`puppet resource` subcommand; run `puppet resource --help` for more information.
### Namevars and titles
All types have a special attribute called the _namevar_. This is the attribute
used to uniquely identify a resource on the target system.
Each resource has a specific namevar attribute, which is listed on this page in
each resource's reference. If you don't specify a value for the namevar, its
value defaults to the resource's _title_.
**Example of a title as a default namevar:**
```puppet
file { '/etc/passwd':
owner => 'root',
group => 'root',
mode => '0644',
}
```
In this code, `/etc/passwd` is the _title_ of the file resource.
The file type's namevar is `path`. Because we didn't provide a `path` value in
this example, the value defaults to the title, `/etc/passwd`.
**Example of a namevar:**
```puppet
file { 'passwords':
path => '/etc/passwd',
owner => 'root',
group => 'root',
mode => '0644',
}
```
This example is functionally similar to the previous example. Its `path`
namevar attribute has an explicitly set value separate from the title, so
its name is still `/etc/passwd`.
Other Puppet code can refer to this resource as `File['/etc/passwd']` to
declare relationships.
### Attributes, parameters, properties
The _attributes_ (sometimes called _parameters_) of a resource determine its
desired state. They either directly modify the system (internally, these are
called "properties") or they affect how the resource behaves (for instance,
adding a search path for `exec` resources or controlling directory recursion
on `file` resources).
### Providers
_Providers_ implement the same resource type on different kinds of systems.
They usually do this by calling out to external commands.
Although Puppet automatically selects an appropriate default provider, you
can override the default with the `provider` attribute. (For example, `package`
resources on Red Hat systems default to the `yum` provider, but you can specify
`provider => gem` to install Ruby libraries with the `gem` command.)
Providers often specify binaries that they require. Fully qualified binary
paths indicate that the binary must exist at that specific path, and
unqualified paths indicate that Puppet searches for the binary using the
shell path.
### Features
_Features_ are abilities that some providers might not support. Generally, a
feature corresponds to some allowed values for a resource attribute.
This is often the case with the `ensure` attribute. In most types, Puppet
doesn't create new resources when omitting `ensure` but still modifies existing
resources to match specifications in the manifest. However, in some types this
isn't always the case, or additional values provide more granular control. For
example, if a `package` provider supports the `purgeable` feature, you can
specify `ensure => purged` to delete configuration files installed by the
package.
Resource types define the set of features they can use, and providers can
declare which features they provide.
## Puppet 6.0 type changes
In Puppet 6.0, we removed some of Puppet's built-in types and moved them into individual modules.
### Supported type modules in `puppet-agent`
The following types are included in supported modules on the Forge. However, they are also included in the `puppet-agent` package, so you do not have to install them separately. See each module's README for detailed information about that type.
- [`augeas`](https://forge.puppet.com/puppetlabs/augeas_core)
- [`cron`](https://forge.puppet.com/puppetlabs/cron_core)
- [`host`](https://forge.puppet.com/puppetlabs/host_core)
- [`mount`](https://forge.puppet.com/puppetlabs/mount_core)
- [`scheduled_task`](https://forge.puppet.com/puppetlabs/scheduled_task)
- [`selboolean`](https://forge.puppet.com/puppetlabs/selinux_core)
- [`selmodule`](https://forge.puppet.com/puppetlabs/selinux_core)
- [`ssh_authorized_key`](https://forge.puppet.com/puppetlabs/sshkeys_core)
- [`sshkey`](https://forge.puppet.com/puppetlabs/sshkeys_core)
- [`yumrepo`](https://forge.puppet.com/puppetlabs/yumrepo_core)
- [`zfs`](https://forge.puppet.com/puppetlabs/zfs_core)
- [`zone`](https://forge.puppet.com/puppetlabs/zone_core)
- [`zpool`](https://forge.puppet.com/puppetlabs/zfs_core)
### Type modules available on the Forge
The following types are contained in modules that are maintained, but are not repackaged into Puppet agent. If you need to use them, you must install the modules separately.
- [`k5login`](https://forge.puppet.com/puppetlabs/k5login_core)
- [`mailalias`](https://forge.puppet.com/puppetlabs/mailalias_core)
- [`maillist`](https://forge.puppet.com/puppetlabs/maillist_core)
### Deprecated types
The following types were deprecated with Puppet 6.0.0. They are available in modules, but are not updated. If you need to use them, you must install the modules separately.
- [`computer`](https://forge.puppet.com/puppetlabs/macdslocal_core)
- [`interface`](https://github.com/puppetlabs/puppetlabs-network_device_core) (Use the updated [`cisco_ios module`](https://forge.puppet.com/puppetlabs/cisco_ios/readme) instead.
- [`macauthorization`](https://forge.puppet.com/puppetlabs/macdslocal_core)
- [`mcx`](https://forge.puppet.com/puppetlabs/macdslocal_core)
- [The Nagios types](https://forge.puppet.com/puppetlabs/nagios_core)
- [`router`](https://github.com/puppetlabs/puppetlabs-network_device_core) (Use the updated [`cisco_ios module`](https://forge.puppet.com/puppetlabs/cisco_ios/readme) instead.
- [`vlan`](https://github.com/puppetlabs/puppetlabs-network_device_core) (Use the updated [`cisco_ios module`](https://forge.puppet.com/puppetlabs/cisco_ios/readme) instead.
## Puppet core types
For a list of core Puppet types, see the [core types cheat sheet][core-types-cheatsheet].
## exec
* [Attributes](#exec-attributes)
* [Providers](#exec-providers)
### Description {#exec-description}
Executes external commands.
Any command in an `exec` resource **must** be able to run multiple times
without causing harm --- that is, it must be *idempotent*. There are three
main ways for an exec to be idempotent:
* The command itself is already idempotent. (For example, `apt-get update`.)
* The exec has an `onlyif`, `unless`, or `creates` attribute, which prevents
Puppet from running the command unless some condition is met. The
`onlyif` and `unless` commands of an `exec` are used in the process of
determining whether the `exec` is already in sync, therefore they must be run
during a noop Puppet run.
* The exec has `refreshonly => true`, which allows Puppet to run the
command only when some other resource is changed. (See the notes on refreshing
below.)
The state managed by an `exec` resource represents whether the specified command
_needs to be_ executed during the catalog run. The target state is always that
the command does not need to be executed. If the initial state is that the
command _does_ need to be executed, then successfully executing the command
transitions it to the target state.
The `unless`, `onlyif`, and `creates` properties check the initial state of the
resource. If one or more of these properties is specified, the exec might not
need to run. If the exec does not need to run, then the system is already in
the target state. In such cases, the exec is considered successful without
actually executing its command.
A caution: There's a widespread tendency to use collections of execs to
manage resources that aren't covered by an existing resource type. This
works fine for simple tasks, but once your exec pile gets complex enough
that you really have to think to understand what's happening, you should
consider developing a custom resource type instead, as it is much
more predictable and maintainable.
**Duplication:** Even though `command` is the namevar, Puppet allows
multiple `exec` resources with the same `command` value.
**Refresh:** `exec` resources can respond to refresh events (via
`notify`, `subscribe`, or the `~>` arrow). The refresh behavior of execs
is non-standard, and can be affected by the `refresh` and
`refreshonly` attributes:
* If `refreshonly` is set to true, the exec runs _only_ when it receives an
event. This is the most reliable way to use refresh with execs.
* If the exec has already run and then receives an event, it runs its
command **up to two times.** If an `onlyif`, `unless`, or `creates` condition
is no longer met after the first run, the second run does not occur.
* If the exec has already run, has a `refresh` command, and receives an
event, it runs its normal command. Then, if any `onlyif`, `unless`, or `creates`
conditions are still met, the exec runs its `refresh` command.
* If the exec has an `onlyif`, `unless`, or `creates` attribute that prevents it
from running, and it then receives an event, it still will not run.
* If the exec has `noop => true`, would otherwise have run, and receives
an event from a non-noop resource, it runs once. However, if it has a `refresh`
command, it runs that instead of its normal command.
In short: If there's a possibility of your exec receiving refresh events,
it is extremely important to make sure the run conditions are restricted.
**Autorequires:** If Puppet is managing an exec's cwd or the executable
file used in an exec's command, the exec resource autorequires those
files. If Puppet is managing the user that an exec should run as, the
exec resource autorequires that user.
### Attributes {#exec-attributes}
<pre><code>exec { 'resource title':
<a href="#exec-attribute-command">command</a> => <em># <strong>(namevar)</strong> The actual command to execute. Must either be...</em>
<a href="#exec-attribute-creates">creates</a> => <em># A file to look for before running the command...</em>
<a href="#exec-attribute-cwd">cwd</a> => <em># The directory from which to run the command. If </em>
<a href="#exec-attribute-environment">environment</a> => <em># An array of any additional environment variables </em>
<a href="#exec-attribute-group">group</a> => <em># The group to run the command as. This seems to...</em>
<a href="#exec-attribute-logoutput">logoutput</a> => <em># Whether to log command output in addition to...</em>
<a href="#exec-attribute-onlyif">onlyif</a> => <em># A test command that checks the state of the...</em>
<a href="#exec-attribute-path">path</a> => <em># The search path used for command execution...</em>
<a href="#exec-attribute-provider">provider</a> => <em># The specific backend to use for this `exec...</em>
<a href="#exec-attribute-refresh">refresh</a> => <em># An alternate command to run when the `exec...</em>
<a href="#exec-attribute-refreshonly">refreshonly</a> => <em># The command should only be run as a refresh...</em>
<a href="#exec-attribute-returns">returns</a> => <em># The expected exit code(s). An error will be...</em>
<a href="#exec-attribute-timeout">timeout</a> => <em># The maximum time the command should take. If...</em>
<a href="#exec-attribute-tries">tries</a> => <em># The number of times execution of the command...</em>
<a href="#exec-attribute-try_sleep">try_sleep</a> => <em># The time to sleep in seconds between...</em>
<a href="#exec-attribute-umask">umask</a> => <em># Sets the umask to be used while executing this...</em>
<a href="#exec-attribute-unless">unless</a> => <em># A test command that checks the state of the...</em>
<a href="#exec-attribute-user">user</a> => <em># The user to run the command as. > **Note:*...</em>
# ...plus any applicable <a href="https://puppet.com/docs/puppet/latest/metaparameter.html">metaparameters</a>.
}</code></pre>
#### command {#exec-attribute-command}
_(**Namevar:** If omitted, this attribute's value defaults to the resource's title.)_
The actual command to execute. Must either be fully qualified
or a search path for the command must be provided. If the command
succeeds, any output produced will be logged at the instance's
normal log level (usually `notice`), but if the command fails
(meaning its return code does not match the specified code) then
any output is logged at the `err` log level.
Multiple `exec` resources can use the same `command` value; Puppet
only uses the resource title to ensure `exec`s are unique.
On *nix platforms, the command can be specified as an array of
strings and Puppet will invoke it using the more secure method of
parameterized system calls. For example, rather than executing the
malicious injected code, this command will echo it out:
command => ['/bin/echo', 'hello world; rm -rf /']
([↑ Back to exec attributes](#exec-attributes))
#### creates {#exec-attribute-creates}
A file to look for before running the command. The command will
only run if the file **doesn't exist.**
This parameter doesn't cause Puppet to create a file; it is only
useful if **the command itself** creates a file.
exec { 'tar -xf /Volumes/nfs02/important.tar':
cwd => '/var/tmp',
creates => '/var/tmp/myfile',
path => ['/usr/bin', '/usr/sbin',],
}
In this example, `myfile` is assumed to be a file inside
`important.tar`. If it is ever deleted, the exec will bring it
back by re-extracting the tarball. If `important.tar` does **not**
actually contain `myfile`, the exec will keep running every time
Puppet runs.
This parameter can also take an array of files, and the command will
not run if **any** of these files exist. Consider this example:
creates => ['/tmp/file1', '/tmp/file2'],
The command is only run if both files don't exist.
([↑ Back to exec attributes](#exec-attributes))
#### cwd {#exec-attribute-cwd}
The directory from which to run the command. If
this directory does not exist, the command will fail.
([↑ Back to exec attributes](#exec-attributes))
#### environment {#exec-attribute-environment}
An array of any additional environment variables you want to set for a
command, such as `[ 'HOME=/root', 'MAIL=root@example.com']`.
Note that if you use this to set PATH, it will override the `path`
attribute. Multiple environment variables should be specified as an
array.
([↑ Back to exec attributes](#exec-attributes))
#### group {#exec-attribute-group}
The group to run the command as. This seems to work quite
haphazardly on different platforms -- it is a platform issue
not a Ruby or Puppet one, since the same variety exists when
running commands as different users in the shell.
([↑ Back to exec attributes](#exec-attributes))
#### logoutput {#exec-attribute-logoutput}
Whether to log command output in addition to logging the
exit code. Defaults to `on_failure`, which only logs the output
when the command has an exit code that does not match any value
specified by the `returns` attribute. As with any resource type,
the log level can be controlled with the `loglevel` metaparameter.
Valid values are `true`, `false`, `on_failure`.
([↑ Back to exec attributes](#exec-attributes))
#### onlyif {#exec-attribute-onlyif}
A test command that checks the state of the target system and restricts
when the `exec` can run. If present, Puppet runs this test command
first, and only runs the main command if the test has an exit code of 0
(success). For example:
exec { 'logrotate':
path => '/usr/bin:/usr/sbin:/bin',
provider => shell,
onlyif => 'test `du /var/log/messages | cut -f1` -gt 100000',
}
This would run `logrotate` only if that test returns true.
Note that this test command runs with the same `provider`, `path`,
`user`, `cwd`, and `group` as the main command. If the `path` isn't set, you
must fully qualify the command's name.
Since this command is used in the process of determining whether the
`exec` is already in sync, it must be run during a noop Puppet run.
This parameter can also take an array of commands. For example:
onlyif => ['test -f /tmp/file1', 'test -f /tmp/file2'],
or an array of arrays. For example:
onlyif => [['test', '-f', '/tmp/file1'], 'test -f /tmp/file2']
This `exec` would only run if every command in the array has an
exit code of 0 (success).
([↑ Back to exec attributes](#exec-attributes))
#### path {#exec-attribute-path}
The search path used for command execution.
Commands must be fully qualified if no path is specified. Paths
can be specified as an array or as a ':' separated list.
([↑ Back to exec attributes](#exec-attributes))
#### provider {#exec-attribute-provider}
The specific backend to use for this `exec`
resource. You will seldom need to specify this --- Puppet will usually
discover the appropriate provider for your platform.
Available providers are:
* [`posix`](#exec-provider-posix)
* [`shell`](#exec-provider-shell)
* [`windows`](#exec-provider-windows)
([↑ Back to exec attributes](#exec-attributes))
#### refresh {#exec-attribute-refresh}
An alternate command to run when the `exec` receives a refresh event
from another resource. By default, Puppet runs the main command again.
For more details, see the notes about refresh behavior above, in the
description for this resource type.
Note that this alternate command runs with the same `provider`, `path`,
`user`, and `group` as the main command. If the `path` isn't set, you
must fully qualify the command's name.
([↑ Back to exec attributes](#exec-attributes))
#### refreshonly {#exec-attribute-refreshonly}
The command should only be run as a
refresh mechanism for when a dependent object is changed. It only
makes sense to use this option when this command depends on some
other object; it is useful for triggering an action:
# Pull down the main aliases file
file { '/etc/aliases':
source => 'puppet://server/module/aliases',
}
# Rebuild the database, but only when the file changes
exec { newaliases:
path => ['/usr/bin', '/usr/sbin'],
subscribe => File['/etc/aliases'],
refreshonly => true,
}
Note that only `subscribe` and `notify` can trigger actions, not `require`,
so it only makes sense to use `refreshonly` with `subscribe` or `notify`.
Valid values are `true`, `false`.
([↑ Back to exec attributes](#exec-attributes))
#### returns {#exec-attribute-returns}
_(**Property:** This attribute represents concrete state on the target system.)_
The expected exit code(s). An error will be returned if the
executed command has some other exit code. Can be specified as an array
of acceptable exit codes or a single value.
On POSIX systems, exit codes are always integers between 0 and 255.
On Windows, **most** exit codes should be integers between 0
and 2147483647.
Larger exit codes on Windows can behave inconsistently across different
tools. The Win32 APIs define exit codes as 32-bit unsigned integers, but
both the cmd.exe shell and the .NET runtime cast them to signed
integers. This means some tools will report negative numbers for exit
codes above 2147483647. (For example, cmd.exe reports 4294967295 as -1.)
Since Puppet uses the plain Win32 APIs, it will report the very large
number instead of the negative number, which might not be what you
expect if you got the exit code from a cmd.exe session.
Microsoft recommends against using negative/very large exit codes, and
you should avoid them when possible. To convert a negative exit code to
the positive one Puppet will use, add it to 4294967296.
([↑ Back to exec attributes](#exec-attributes))
#### timeout {#exec-attribute-timeout}
The maximum time the command should take. If the command takes
longer than the timeout, the command is considered to have failed
and will be stopped. The timeout is specified in seconds. The default
timeout is 300 seconds and you can set it to 0 to disable the timeout.
([↑ Back to exec attributes](#exec-attributes))
#### tries {#exec-attribute-tries}
The number of times execution of the command should be tried.
This many attempts will be made to execute the command until an
acceptable return code is returned. Note that the timeout parameter
applies to each try rather than to the complete set of tries.
([↑ Back to exec attributes](#exec-attributes))
#### try_sleep {#exec-attribute-try_sleep}
The time to sleep in seconds between 'tries'.
([↑ Back to exec attributes](#exec-attributes))
#### umask {#exec-attribute-umask}
Sets the umask to be used while executing this command
([↑ Back to exec attributes](#exec-attributes))
#### unless {#exec-attribute-unless}
A test command that checks the state of the target system and restricts
when the `exec` can run. If present, Puppet runs this test command
first, then runs the main command unless the test has an exit code of 0
(success). For example:
exec { '/bin/echo root >> /usr/lib/cron/cron.allow':
path => '/usr/bin:/usr/sbin:/bin',
unless => 'grep ^root$ /usr/lib/cron/cron.allow 2>/dev/null',
}
This would add `root` to the cron.allow file (on Solaris) unless
`grep` determines it's already there.
Note that this test command runs with the same `provider`, `path`,
`user`, `cwd`, and `group` as the main command. If the `path` isn't set, you
must fully qualify the command's name.
Since this command is used in the process of determining whether the
`exec` is already in sync, it must be run during a noop Puppet run.
This parameter can also take an array of commands. For example:
unless => ['test -f /tmp/file1', 'test -f /tmp/file2'],
or an array of arrays. For example:
unless => [['test', '-f', '/tmp/file1'], 'test -f /tmp/file2']
This `exec` would only run if every command in the array has a
non-zero exit code.
([↑ Back to exec attributes](#exec-attributes))
#### user {#exec-attribute-user}
The user to run the command as.
> **Note:** Puppet cannot execute commands as other users on Windows.
Note that if you use this attribute, any error output is not captured
due to a bug within Ruby. If you use Puppet to create this user, the
exec automatically requires the user, as long as it is specified by
name.
The $HOME environment variable is not automatically set when using
this attribute.
([↑ Back to exec attributes](#exec-attributes))
### Providers {#exec-providers}
#### posix {#exec-provider-posix}
Executes external binaries by invoking Ruby's `Kernel.exec`.
When the command is a string, it will be executed directly,
without a shell, if it follows these rules:
- no meta characters
- no shell reserved word and no special built-in
When the command is an Array of Strings, passed as `[cmdname, arg1, ...]`
it will be executed directly(the first element is taken as a command name
and the rest are passed as parameters to command with no shell expansion)
This is a safer and more predictable way to execute most commands,
but prevents the use of globbing and shell built-ins (including control
logic like "for" and "if" statements).
If the use of globbing and shell built-ins is desired, please check
the `shell` provider
* Default for `feature` == `posix`.
#### shell {#exec-provider-shell}
Passes the provided command through `/bin/sh`; only available on
POSIX systems. This allows the use of shell globbing and built-ins, and
does not require that the path to a command be fully-qualified. Although
this can be more convenient than the `posix` provider, it also means that
you need to be more careful with escaping; as ever, with great power comes
etc. etc.
This provider closely resembles the behavior of the `exec` type
in Puppet 0.25.x.
#### windows {#exec-provider-windows}
Execute external binaries on Windows systems. As with the `posix`
provider, this provider directly calls the command with the arguments
given, without passing it through a shell or performing any interpolation.
To use shell built-ins --- that is, to emulate the `shell` provider on
Windows --- a command must explicitly invoke the shell:
exec {'echo foo':
command => 'cmd.exe /c echo "foo"',
}
If no extension is specified for a command, Windows will use the `PATHEXT`
environment variable to locate the executable.
**Note on PowerShell scripts:** PowerShell's default `restricted`
execution policy doesn't allow it to run saved scripts. To run PowerShell
scripts, specify the `remotesigned` execution policy as part of the
command:
exec { 'test':
path => 'C:/Windows/System32/WindowsPowerShell/v1.0',
command => 'powershell -executionpolicy remotesigned -file C:/test.ps1',
}
* Default for `os.name` == `windows`.
---------
## file
* [Attributes](#file-attributes)
* [Providers](#file-providers)
* [Provider Features](#file-provider-features)
### Description {#file-description}
Manages files, including their content, ownership, and permissions.
The `file` type can manage normal files, directories, and symlinks; the
type should be specified in the `ensure` attribute.
File contents can be managed directly with the `content` attribute, or
downloaded from a remote source using the `source` attribute; the latter
can also be used to recursively serve directories (when the `recurse`
attribute is set to `true` or `local`). On Windows, note that file
contents are managed in binary mode; Puppet never automatically translates
line endings.
**Autorequires:** If Puppet is managing the user or group that owns a
file, the file resource will autorequire them. If Puppet is managing any
parent directories of a file, the file resource autorequires them.
Warning: Enabling `recurse` on directories containing large numbers of
files slows agent runs. To manage file attributes for many files,
consider using alternative methods such as the `chmod_r`, `chown_r`,
or `recursive_file_permissions` modules from the Forge.
### Attributes {#file-attributes}
<pre><code>file { 'resource title':
<a href="#file-attribute-path">path</a> => <em># <strong>(namevar)</strong> The path to the file to manage. Must be fully...</em>
<a href="#file-attribute-ensure">ensure</a> => <em># Whether the file should exist, and if so what...</em>
<a href="#file-attribute-backup">backup</a> => <em># Whether (and how) file content should be backed...</em>
<a href="#file-attribute-checksum">checksum</a> => <em># The checksum type to use when determining...</em>
<a href="#file-attribute-checksum_value">checksum_value</a> => <em># The checksum of the source contents. Only md5...</em>
<a href="#file-attribute-content">content</a> => <em># The desired contents of a file, as a string...</em>
<a href="#file-attribute-ctime">ctime</a> => <em># A read-only state to check the file ctime. On...</em>
<a href="#file-attribute-force">force</a> => <em># Perform the file operation even if it will...</em>
<a href="#file-attribute-group">group</a> => <em># Which group should own the file. Argument can...</em>
<a href="#file-attribute-ignore">ignore</a> => <em># A parameter which omits action on files matching </em>
<a href="#file-attribute-links">links</a> => <em># How to handle links during file actions. During </em>
<a href="#file-attribute-max_files">max_files</a> => <em># In case the resource is a directory and the...</em>
<a href="#file-attribute-mode">mode</a> => <em># The desired permissions mode for the file, in...</em>
<a href="#file-attribute-mtime">mtime</a> => <em># A read-only state to check the file mtime. On...</em>
<a href="#file-attribute-owner">owner</a> => <em># The user to whom the file should belong....</em>
<a href="#file-attribute-provider">provider</a> => <em># The specific backend to use for this `file...</em>
<a href="#file-attribute-purge">purge</a> => <em># Whether unmanaged files should be purged. This...</em>
<a href="#file-attribute-recurse">recurse</a> => <em># Whether to recursively manage the _contents_ of...</em>
<a href="#file-attribute-recurselimit">recurselimit</a> => <em># How far Puppet should descend into...</em>
<a href="#file-attribute-replace">replace</a> => <em># Whether to replace a file or symlink that...</em>
<a href="#file-attribute-selinux_ignore_defaults">selinux_ignore_defaults</a> => <em># If this is set, Puppet will not call the SELinux </em>
<a href="#file-attribute-selrange">selrange</a> => <em># What the SELinux range component of the context...</em>
<a href="#file-attribute-selrole">selrole</a> => <em># What the SELinux role component of the context...</em>
<a href="#file-attribute-seltype">seltype</a> => <em># What the SELinux type component of the context...</em>
<a href="#file-attribute-seluser">seluser</a> => <em># What the SELinux user component of the context...</em>
<a href="#file-attribute-show_diff">show_diff</a> => <em># Whether to display differences when the file...</em>
<a href="#file-attribute-source">source</a> => <em># A source file, which will be copied into place...</em>
<a href="#file-attribute-source_permissions">source_permissions</a> => <em># Whether (and how) Puppet should copy owner...</em>
<a href="#file-attribute-sourceselect">sourceselect</a> => <em># Whether to copy all valid sources, or just the...</em>
<a href="#file-attribute-staging_location">staging_location</a> => <em># When rendering a file first render it to this...</em>
<a href="#file-attribute-target">target</a> => <em># The target for creating a link. Currently...</em>
<a href="#file-attribute-type">type</a> => <em># A read-only state to check the file...</em>
<a href="#file-attribute-validate_cmd">validate_cmd</a> => <em># A command for validating the file's syntax...</em>
<a href="#file-attribute-validate_replacement">validate_replacement</a> => <em># The replacement string in a `validate_cmd` that...</em>
# ...plus any applicable <a href="https://puppet.com/docs/puppet/latest/metaparameter.html">metaparameters</a>.
}</code></pre>
#### path {#file-attribute-path}
_(**Namevar:** If omitted, this attribute's value defaults to the resource's title.)_
The path to the file to manage. Must be fully qualified.
On Windows, the path should include the drive letter and should use `/` as
the separator character (rather than `\\`).
([↑ Back to file attributes](#file-attributes))
#### ensure {#file-attribute-ensure}
_(**Property:** This attribute represents concrete state on the target system.)_
Whether the file should exist, and if so what kind of file it should be.
Possible values are `present`, `absent`, `file`, `directory`, and `link`.
* `present` accepts any form of file existence, and creates a
normal file if the file is missing. (The file will have no content
unless the `content` or `source` attribute is used.)
* `absent` ensures the file doesn't exist, and deletes it if necessary.
* `file` ensures it's a normal file, and enables use of the `content` or
`source` attribute.
* `directory` ensures it's a directory, and enables use of the `source`,
`recurse`, `recurselimit`, `ignore`, and `purge` attributes.
* `link` ensures the file is a symlink, and **requires** that you also
set the `target` attribute. Symlinks are supported on all Posix
systems and on Windows Vista / 2008 and higher. On Windows, managing
symlinks requires Puppet agent's user account to have the "Create
Symbolic Links" privilege; this can be configured in the "User Rights
Assignment" section in the Windows policy editor. By default, Puppet
agent runs as the Administrator account, which has this privilege.
Puppet avoids destroying directories unless the `force` attribute is set
to `true`. This means that if a file is currently a directory, setting
`ensure` to anything but `directory` or `present` will cause Puppet to
skip managing the resource and log either a notice or an error.
There is one other non-standard value for `ensure`. If you specify the
path to another file as the ensure value, it is equivalent to specifying
`link` and using that path as the `target`:
# Equivalent resources:
file { '/etc/inetd.conf':
ensure => '/etc/inet/inetd.conf',
}
file { '/etc/inetd.conf':
ensure => link,
target => '/etc/inet/inetd.conf',
}
However, we recommend using `link` and `target` explicitly, since this
behavior can be harder to read and is
[deprecated](https://docs.puppet.com/puppet/4.3/deprecated_language.html)
as of Puppet 4.3.0.
Valid values are `absent` (also called `false`), `file`, `present`, `directory`, `link`. Values can match `/./`.
([↑ Back to file attributes](#file-attributes))
#### backup {#file-attribute-backup}
Whether (and how) file content should be backed up before being replaced.
This attribute works best as a resource default in the site manifest
(`File { backup => main }`), so it can affect all file resources.
* If set to `false`, file content won't be backed up.
* If set to a string beginning with `.`, such as `.puppet-bak`, Puppet will
use copy the file in the same directory with that value as the extension
of the backup. (A value of `true` is a synonym for `.puppet-bak`.)
* If set to any other string, Puppet will try to back up to a filebucket
with that title. Puppet automatically creates a **local** filebucket
named `puppet` if one doesn't already exist. See the `filebucket` resource
type for more details.
Default value: `false`
Backing up to a local filebucket isn't particularly useful. If you want
to make organized use of backups, you will generally want to use the
primary Puppet server's filebucket service. This requires declaring a
filebucket resource and a resource default for the `backup` attribute
in site.pp:
# /etc/puppetlabs/puppet/manifests/site.pp
filebucket { 'main':
path => false, # This is required for remote filebuckets.
server => 'puppet.example.com', # Optional; defaults to the configured primary Puppet server.
}
File { backup => main, }
If you are using multiple primary servers, you will want to
centralize the contents of the filebucket. Either configure your load
balancer to direct all filebucket traffic to a single primary server, or use
something like an out-of-band rsync task to synchronize the content on all
primary servers.
> **Note**: Enabling and using the backup option, and by extension the
filebucket resource, requires appropriate planning and management to ensure
that sufficient disk space is available for the file backups. Generally, you
can implement this using one of the following two options:
- Use a `find` command and `crontab` entry to retain only the last X days
of file backups. For example:
```
find /opt/puppetlabs/server/data/puppetserver/bucket -type f -mtime +45 -atime +45 -print0 | xargs -0 rm
```
- Restrict the directory to a maximum size after which the oldest items are removed.
([↑ Back to file attributes](#file-attributes))
#### checksum {#file-attribute-checksum}
The checksum type to use when determining whether to replace a file's contents.
The default checksum type is sha256.
Valid values are `sha256`, `sha256lite`, `md5`, `md5lite`, `sha1`, `sha1lite`, `sha512`, `sha384`, `sha224`, `mtime`, `ctime`, `none`.
([↑ Back to file attributes](#file-attributes))
#### checksum_value {#file-attribute-checksum_value}
_(**Property:** This attribute represents concrete state on the target system.)_
The checksum of the source contents. Only md5, sha256, sha224, sha384 and sha512
are supported when specifying this parameter. If this parameter is set,
source_permissions will be assumed to be false, and ownership and permissions
will not be read from source.
([↑ Back to file attributes](#file-attributes))
#### content {#file-attribute-content}
_(**Property:** This attribute represents concrete state on the target system.)_
The desired contents of a file, as a string. This attribute is mutually
exclusive with `source` and `target`.
Newlines and tabs can be specified in double-quoted strings using
standard escaped syntax --- \n for a newline, and \t for a tab.
With very small files, you can construct content strings directly in
the manifest...
define resolve($nameserver1, $nameserver2, $domain, $search) {
$str = "search ${search}
domain ${domain}
nameserver ${nameserver1}
nameserver ${nameserver2}
"
file { '/etc/resolv.conf':
content => $str,
}
}
...but for larger files, this attribute is more useful when combined with the
[template](https://puppet.com/docs/puppet/latest/function.html#template)
or [file](https://puppet.com/docs/puppet/latest/function.html#file)
function.
([↑ Back to file attributes](#file-attributes))
#### ctime {#file-attribute-ctime}
_(**Property:** This attribute represents concrete state on the target system.)_
A read-only state to check the file ctime. On most modern *nix-like
systems, this is the time of the most recent change to the owner, group,
permissions, or content of the file.
([↑ Back to file attributes](#file-attributes))
#### force {#file-attribute-force}
Perform the file operation even if it will destroy one or more directories.
You must use `force` in order to:
* `purge` subdirectories
* Replace directories with files or links
* Remove a directory when `ensure => absent`
Valid values are `true`, `false`, `yes`, `no`.
([↑ Back to file attributes](#file-attributes))
#### group {#file-attribute-group}
_(**Property:** This attribute represents concrete state on the target system.)_
Which group should own the file. Argument can be either a group
name or a group ID.
On Windows, a user (such as "Administrator") can be set as a file's group
and a group (such as "Administrators") can be set as a file's owner;
however, a file's owner and group shouldn't be the same. (If the owner
is also the group, files with modes like `"0640"` will cause log churn, as
they will always appear out of sync.)
([↑ Back to file attributes](#file-attributes))
#### ignore {#file-attribute-ignore}
A parameter which omits action on files matching
specified patterns during recursion. Uses Ruby's builtin globbing
engine, so shell metacharacters such as `[a-z]*` are fully supported.
Matches that would descend into the directory structure are ignored,
such as `*/*`.
([↑ Back to file attributes](#file-attributes))
#### links {#file-attribute-links}
How to handle links during file actions. During file copying,
`follow` will copy the target file instead of the link and `manage`
will copy the link itself. When not copying, `manage` will manage
the link, and `follow` will manage the file to which the link points.
Valid values are `follow`, `manage`.
([↑ Back to file attributes](#file-attributes))
#### max_files {#file-attribute-max_files}
In case the resource is a directory and the recursion is enabled, puppet will
generate a new resource for each file file found, possible leading to
an excessive number of resources generated without any control.
Setting `max_files` will check the number of file resources that
will eventually be created and will raise a resource argument error if the
limit will be exceeded.
Use value `0` to log a warning instead of raising an error.
Use value `-1` to disable errors and warnings due to max files.
Values can match `/^[0-9]+$/`, `/^-1$/`.
([↑ Back to file attributes](#file-attributes))
#### mode {#file-attribute-mode}
_(**Property:** This attribute represents concrete state on the target system.)_
The desired permissions mode for the file, in symbolic or numeric
notation. This value **must** be specified as a string; do not use
un-quoted numbers to represent file modes.
If the mode is omitted (or explicitly set to `undef`), Puppet does not
enforce permissions on existing files and creates new files with
permissions of `0644`.
The `file` type uses traditional Unix permission schemes and translates
them to equivalent permissions for systems which represent permissions
differently, including Windows. For detailed ACL controls on Windows,
you can leave `mode` unmanaged and use
[the puppetlabs/acl module.](https://forge.puppetlabs.com/puppetlabs/acl)
Numeric modes should use the standard octal notation of
`<SETUID/SETGID/STICKY><OWNER><GROUP><OTHER>` (for example, "0644").
* Each of the "owner," "group," and "other" digits should be a sum of the
permissions for that class of users, where read = 4, write = 2, and
execute/search = 1.
* The setuid/setgid/sticky digit is also a sum, where setuid = 4, setgid = 2,
and sticky = 1.
* The setuid/setgid/sticky digit is optional. If it is absent, Puppet will
clear any existing setuid/setgid/sticky permissions. (So to make your intent
clear, you should use at least four digits for numeric modes.)
* When specifying numeric permissions for directories, Puppet sets the search
permission wherever the read permission is set.
Symbolic modes should be represented as a string of comma-separated
permission clauses, in the form `<WHO><OP><PERM>`:
* "Who" should be any combination of u (user), g (group), and o (other), or a (all)
* "Op" should be = (set exact permissions), + (add select permissions),
or - (remove select permissions)
* "Perm" should be one or more of:
* r (read)
* w (write)
* x (execute/search)
* t (sticky)
* s (setuid/setgid)
* X (execute/search if directory or if any one user can execute)
* u (user's current permissions)
* g (group's current permissions)
* o (other's current permissions)
Thus, mode `"0664"` could be represented symbolically as either `a=r,ug+w`
or `ug=rw,o=r`. However, symbolic modes are more expressive than numeric
modes: a mode only affects the specified bits, so `mode => 'ug+w'` will
set the user and group write bits, without affecting any other bits.
See the manual page for GNU or BSD `chmod` for more details
on numeric and symbolic modes.
On Windows, permissions are translated as follows:
* Owner and group names are mapped to Windows SIDs
* The "other" class of users maps to the "Everyone" SID
* The read/write/execute permissions map to the `FILE_GENERIC_READ`,
`FILE_GENERIC_WRITE`, and `FILE_GENERIC_EXECUTE` access rights; a
file's owner always has the `FULL_CONTROL` right
* "Other" users can't have any permissions a file's group lacks,
and its group can't have any permissions its owner lacks; that is, "0644"
is an acceptable mode, but "0464" is not.
([↑ Back to file attributes](#file-attributes))
#### mtime {#file-attribute-mtime}
_(**Property:** This attribute represents concrete state on the target system.)_
A read-only state to check the file mtime. On *nix-like systems, this
is the time of the most recent change to the content of the file.
([↑ Back to file attributes](#file-attributes))
#### owner {#file-attribute-owner}
_(**Property:** This attribute represents concrete state on the target system.)_
The user to whom the file should belong. Argument can be a user name or a
user ID.
On Windows, a group (such as "Administrators") can be set as a file's owner
and a user (such as "Administrator") can be set as a file's group; however,
a file's owner and group shouldn't be the same. (If the owner is also
the group, files with modes like `"0640"` will cause log churn, as they
will always appear out of sync.)
([↑ Back to file attributes](#file-attributes))
#### provider {#file-attribute-provider}
The specific backend to use for this `file`
resource. You will seldom need to specify this --- Puppet will usually
discover the appropriate provider for your platform.
Available providers are:
* [`posix`](#file-provider-posix)
* [`windows`](#file-provider-windows)
([↑ Back to file attributes](#file-attributes))
#### purge {#file-attribute-purge}
Whether unmanaged files should be purged. This option only makes
sense when `ensure => directory` and `recurse => true`.
* When recursively duplicating an entire directory with the `source`
attribute, `purge => true` will automatically purge any files
that are not in the source directory.
* When managing files in a directory as individual resources,
setting `purge => true` will purge any files that aren't being
specifically managed.
If you have a filebucket configured, the purged files will be uploaded,
but if you do not, this will destroy data.
Unless `force => true` is set, purging will **not** delete directories,
although it will delete the files they contain.
If `recurselimit` is set and you aren't using `force => true`, purging
will obey the recursion limit; files in any subdirectories deeper than the
limit will be treated as unmanaged and left alone.
Valid values are `true`, `false`, `yes`, `no`.
([↑ Back to file attributes](#file-attributes))
#### recurse {#file-attribute-recurse}
Whether to recursively manage the _contents_ of a directory. This attribute
is only used when `ensure => directory` is set. The allowed values are:
* `false` --- The default behavior. The contents of the directory will not be
automatically managed.
* `remote` --- If the `source` attribute is set, Puppet will automatically
manage the contents of the source directory (or directories), ensuring
that equivalent files and directories exist on the target system and
that their contents match.
Using `remote` will disable the `purge` attribute, but results in faster
catalog application than `recurse => true`.
The `source` attribute is mandatory when `recurse => remote`.
* `true` --- If the `source` attribute is set, this behaves similarly to
`recurse => remote`, automatically managing files from the source directory.
This also enables the `purge` attribute, which can delete unmanaged
files from a directory. See the description of `purge` for more details.
The `source` attribute is not mandatory when using `recurse => true`, so you
can enable purging in directories where all files are managed individually.
By default, setting recurse to `remote` or `true` will manage _all_
subdirectories. You can use the `recurselimit` attribute to limit the
recursion depth.
Valid values are `true`, `false`, `remote`.
([↑ Back to file attributes](#file-attributes))
#### recurselimit {#file-attribute-recurselimit}
How far Puppet should descend into subdirectories, when using
`ensure => directory` and either `recurse => true` or `recurse => remote`.
The recursion limit affects which files will be copied from the `source`
directory, as well as which files can be purged when `purge => true`.
Setting `recurselimit => 0` is the same as setting `recurse => false` ---
Puppet will manage the directory, but all of its contents will be treated
as unmanaged.
Setting `recurselimit => 1` will manage files and directories that are
directly inside the directory, but will not manage the contents of any
subdirectories.
Setting `recurselimit => 2` will manage the direct contents of the
directory, as well as the contents of the _first_ level of subdirectories.
This pattern continues for each incremental value of `recurselimit`.
Values can match `/^[0-9]+$/`.
([↑ Back to file attributes](#file-attributes))
#### replace {#file-attribute-replace}
Whether to replace a file or symlink that already exists on the local system but
whose content doesn't match what the `source` or `content` attribute
specifies. Setting this to false allows file resources to initialize files
without overwriting future changes. Note that this only affects content;
Puppet will still manage ownership and permissions.
Valid values are `true`, `false`, `yes`, `no`.
([↑ Back to file attributes](#file-attributes))
#### selinux_ignore_defaults {#file-attribute-selinux_ignore_defaults}
If this is set, Puppet will not call the SELinux function selabel_lookup to
supply defaults for the SELinux attributes (seluser, selrole,
seltype, and selrange). In general, you should leave this set at its
default and only set it to true when you need Puppet to not try to fix
SELinux labels automatically.
Valid values are `true`, `false`.
([↑ Back to file attributes](#file-attributes))
#### selrange {#file-attribute-selrange}
_(**Property:** This attribute represents concrete state on the target system.)_
What the SELinux range component of the context of the file should be.
Any valid SELinux range component is accepted. For example `s0` or
`SystemHigh`. If not specified, it defaults to the value returned by
selabel_lookup for the file, if any exists. Only valid on systems with
SELinux support enabled and that have support for MCS (Multi-Category
Security).
([↑ Back to file attributes](#file-attributes))
#### selrole {#file-attribute-selrole}
_(**Property:** This attribute represents concrete state on the target system.)_
What the SELinux role component of the context of the file should be.
Any valid SELinux role component is accepted. For example `role_r`.
If not specified, it defaults to the value returned by selabel_lookup for
the file, if any exists. Only valid on systems with SELinux support
enabled.
([↑ Back to file attributes](#file-attributes))
#### seltype {#file-attribute-seltype}
_(**Property:** This attribute represents concrete state on the target system.)_
What the SELinux type component of the context of the file should be.
Any valid SELinux type component is accepted. For example `tmp_t`.
If not specified, it defaults to the value returned by selabel_lookup for
the file, if any exists. Only valid on systems with SELinux support
enabled.
([↑ Back to file attributes](#file-attributes))
#### seluser {#file-attribute-seluser}
_(**Property:** This attribute represents concrete state on the target system.)_
What the SELinux user component of the context of the file should be.
Any valid SELinux user component is accepted. For example `user_u`.
If not specified, it defaults to the value returned by selabel_lookup for
the file, if any exists. Only valid on systems with SELinux support
enabled.
([↑ Back to file attributes](#file-attributes))
#### show_diff {#file-attribute-show_diff}
Whether to display differences when the file changes, defaulting to
true. This parameter is useful for files that may contain passwords or
other secret data, which might otherwise be included in Puppet reports or
other insecure outputs. If the global `show_diff` setting
is false, then no diffs will be shown even if this parameter is true.
Valid values are `true`, `false`, `yes`, `no`.
([↑ Back to file attributes](#file-attributes))
#### source {#file-attribute-source}
A source file, which will be copied into place on the local system. This
attribute is mutually exclusive with `content` and `target`. Allowed
values are:
* `puppet:` URIs, which point to files in modules or Puppet file server
mount points.
* Fully qualified paths to locally available files (including files on NFS
shares or Windows mapped drives).
* `file:` URIs, which behave the same as local file paths.
* `http(s):` URIs, which point to files served by common web servers.
The normal form of a `puppet:` URI is:
`puppet:///modules/<MODULE NAME>/<FILE PATH>`
This will fetch a file from a module on the Puppet master (or from a
local module when using Puppet apply). Given a `modulepath` of
`/etc/puppetlabs/code/modules`, the example above would resolve to
`/etc/puppetlabs/code/modules/<MODULE NAME>/files/<FILE PATH>`.
Unlike `content`, the `source` attribute can be used to recursively copy
directories if the `recurse` attribute is set to `true` or `remote`. If
a source directory contains symlinks, use the `links` attribute to
specify whether to recreate links or follow them.
_HTTP_ URIs cannot be used to recursively synchronize whole directory
trees. You cannot use `source_permissions` values other than `ignore`
because HTTP servers do not transfer any metadata that translates to
ownership or permission details.
Puppet determines if file content is synchronized by computing a checksum
for the local file and comparing it against the `checksum_value`
parameter. If the `checksum_value` parameter is not specified for
`puppet` and `file` sources, Puppet computes a checksum based on its
`Puppet[:digest_algorithm]`. For `http(s)` sources, Puppet uses the
first HTTP header it recognizes out of the following list:
`X-Checksum-Sha256`, `X-Checksum-Sha1`, `X-Checksum-Md5` or `Content-MD5`.
If the server response does not include one of these headers, Puppet
defaults to using the `Last-Modified` header. Puppet updates the local
file if the header is newer than the modified time (mtime) of the local
file.
_HTTP_ URIs can include a user information component so that Puppet can
retrieve file metadata and content from HTTP servers that require HTTP Basic
authentication. For example `https://<user>:<pass>@<server>:<port>/path/to/file.`
When connecting to _HTTPS_ servers, Puppet trusts CA certificates in the
puppet-agent certificate bundle and the Puppet CA. You can configure Puppet
to trust additional CA certificates using the `Puppet[:ssl_trust_store]`
setting.
Multiple `source` values can be specified as an array, and Puppet will
use the first source that exists. This can be used to serve different
files to different system types:
file { '/etc/nfs.conf':
source => [
"puppet:///modules/nfs/conf.${host}",
"puppet:///modules/nfs/conf.${os['name']}",
'puppet:///modules/nfs/conf'
]
}
Alternately, when serving directories recursively, multiple sources can
be combined by setting the `sourceselect` attribute to `all`.
([↑ Back to file attributes](#file-attributes))
#### source_permissions {#file-attribute-source_permissions}
Whether (and how) Puppet should copy owner, group, and mode permissions from
the `source` to `file` resources when the permissions are not explicitly
specified. (In all cases, explicit permissions will take precedence.)
Valid values are `use`, `use_when_creating`, and `ignore`:
* `ignore` (the default) will never apply the owner, group, or mode from
the `source` when managing a file. When creating new files without explicit
permissions, the permissions they receive will depend on platform-specific
behavior. On POSIX, Puppet will use the umask of the user it is running as.
On Windows, Puppet will use the default DACL associated with the user it is
running as.
* `use` will cause Puppet to apply the owner, group,
and mode from the `source` to any files it is managing.
* `use_when_creating` will only apply the owner, group, and mode from the
`source` when creating a file; existing files will not have their permissions
overwritten.
Valid values are `use`, `use_when_creating`, `ignore`.
([↑ Back to file attributes](#file-attributes))
#### sourceselect {#file-attribute-sourceselect}
Whether to copy all valid sources, or just the first one. This parameter
only affects recursive directory copies; by default, the first valid
source is the only one used, but if this parameter is set to `all`, then
all valid sources will have all of their contents copied to the local
system. If a given file exists in more than one source, the version from
the earliest source in the list will be used.
Valid values are `first`, `all`.
([↑ Back to file attributes](#file-attributes))
#### staging_location {#file-attribute-staging_location}
When rendering a file first render it to this location. The default
location is the same path as the desired location with a unique filename.
This parameter is useful in conjuction with validate_cmd to test a
file before moving the file to it's final location.
WARNING: File replacement is only guaranteed to be atomic if the staging
location is on the same filesystem as the final location.
([↑ Back to file attributes](#file-attributes))
#### target {#file-attribute-target}
_(**Property:** This attribute represents concrete state on the target system.)_
The target for creating a link. Currently, symlinks are the
only type supported. This attribute is mutually exclusive with `source`
and `content`.
Symlink targets can be relative, as well as absolute:
# (Useful on Solaris)
file { '/etc/inetd.conf':
ensure => link,
target => 'inet/inetd.conf',
}
Directories of symlinks can be served recursively by instead using the
`source` attribute, setting `ensure` to `directory`, and setting the
`links` attribute to `manage`.
Valid values are `notlink`. Values can match `/./`.
([↑ Back to file attributes](#file-attributes))
#### type {#file-attribute-type}
_(**Property:** This attribute represents concrete state on the target system.)_
A read-only state to check the file type.
([↑ Back to file attributes](#file-attributes))
#### validate_cmd {#file-attribute-validate_cmd}
A command for validating the file's syntax before replacing it. If
Puppet would need to rewrite a file due to new `source` or `content`, it
will check the new content's validity first. If validation fails, the file
resource will fail.
This command must have a fully qualified path, and should contain a
percent (`%`) token where it would expect an input file. It must exit `0`
if the syntax is correct, and non-zero otherwise. The command will be
run on the target system while applying the catalog, not on the primary Puppet server.
Example:
file { '/etc/apache2/apache2.conf':
content => 'example',
validate_cmd => '/usr/sbin/apache2 -t -f %',
}
This would replace apache2.conf only if the test returned true.
Note that if a validation command requires a `%` as part of its text,
you can specify a different placeholder token with the
`validate_replacement` attribute.
([↑ Back to file attributes](#file-attributes))
#### validate_replacement {#file-attribute-validate_replacement}
The replacement string in a `validate_cmd` that will be replaced
with an input file name.
([↑ Back to file attributes](#file-attributes))
### Providers {#file-providers}
#### posix {#file-provider-posix}
Uses POSIX functionality to manage file ownership and permissions.
* Supported features: `manages_symlinks`.
#### windows {#file-provider-windows}
Uses Microsoft Windows functionality to manage file ownership and permissions.
* Supported features: `manages_symlinks`.
### Provider Features {#file-provider-features}
Available features:
* `manages_symlinks` --- The provider can manage symbolic links.
Provider support:
* **posix** - _manages symlinks_
* **windows** - _manages symlinks_
---------
## filebucket
* [Attributes](#filebucket-attributes)
### Description {#filebucket-description}
A repository for storing and retrieving file content by cryptographic checksum. Can
be local to each agent node, or centralized on a primary Puppet server. All
puppet servers provide a filebucket service that agent nodes can access
via HTTP, but you must declare a filebucket resource before any agents
will do so.
Filebuckets are used for the following features:
- **Content backups.** If the `file` type's `backup` attribute is set to
the name of a filebucket, Puppet will back up the _old_ content whenever
it rewrites a file; see the documentation for the `file` type for more
details. These backups can be used for manual recovery of content, but
are more commonly used to display changes and differences in a tool like
Puppet Dashboard.
To use a central filebucket for backups, you will usually want to declare
a filebucket resource and a resource default for the `backup` attribute
in site.pp:
# /etc/puppetlabs/puppet/manifests/site.pp
filebucket { 'main':
path => false, # This is required for remote filebuckets.
server => 'puppet.example.com', # Optional; defaults to the configured primary server.
}
File { backup => main, }
Puppet Servers automatically provide the filebucket service, so
this will work in a default configuration. If you have a heavily
restricted Puppet Server `auth.conf` file, you may need to allow access to the
`file_bucket_file` endpoint.
### Attributes {#filebucket-attributes}
<pre><code>filebucket { 'resource title':
<a href="#filebucket-attribute-name">name</a> => <em># <strong>(namevar)</strong> The name of the...</em>
<a href="#filebucket-attribute-path">path</a> => <em># The path to the _local_ filebucket; defaults to...</em>
<a href="#filebucket-attribute-port">port</a> => <em># The port on which the remote server is...</em>
<a href="#filebucket-attribute-server">server</a> => <em># The server providing the remote filebucket...</em>
# ...plus any applicable <a href="https://puppet.com/docs/puppet/latest/metaparameter.html">metaparameters</a>.
}</code></pre>
#### name {#filebucket-attribute-name}
_(**Namevar:** If omitted, this attribute's value defaults to the resource's title.)_
The name of the filebucket.
([↑ Back to filebucket attributes](#filebucket-attributes))
#### path {#filebucket-attribute-path}
The path to the _local_ filebucket; defaults to the value of the
`clientbucketdir` setting. To use a remote filebucket, you _must_ set
this attribute to `false`.
([↑ Back to filebucket attributes](#filebucket-attributes))
#### port {#filebucket-attribute-port}
The port on which the remote server is listening.
This setting is _only_ consulted if the `path` attribute is set to `false`.
If this attribute is not specified, the first entry in the `server_list`
configuration setting is used, followed by the value of the `serverport`
setting if `server_list` is not set.
([↑ Back to filebucket attributes](#filebucket-attributes))
#### server {#filebucket-attribute-server}
The server providing the remote filebucket service.
This setting is _only_ consulted if the `path` attribute is set to `false`.
If this attribute is not specified, the first entry in the `server_list`
configuration setting is used, followed by the value of the `server` setting
if `server_list` is not set.
([↑ Back to filebucket attributes](#filebucket-attributes))
---------
## group
* [Attributes](#group-attributes)
* [Providers](#group-providers)
* [Provider Features](#group-provider-features)
### Description {#group-description}
Manage groups. On most platforms this can only create groups.
Group membership must be managed on individual users.
On some platforms such as OS X, group membership is managed as an
attribute of the group, not the user record. Providers must have
the feature 'manages_members' to manage the 'members' property of
a group record.
### Attributes {#group-attributes}
<pre><code>group { 'resource title':
<a href="#group-attribute-name">name</a> => <em># <strong>(namevar)</strong> The group name. While naming limitations vary by </em>
<a href="#group-attribute-ensure">ensure</a> => <em># Create or remove the group. Valid values are...</em>
<a href="#group-attribute-allowdupe">allowdupe</a> => <em># Whether to allow duplicate GIDs. Valid values...</em>
<a href="#group-attribute-attribute_membership">attribute_membership</a> => <em># AIX only. Configures the behavior of the...</em>
<a href="#group-attribute-attributes">attributes</a> => <em># Specify group AIX attributes, as an array of...</em>
<a href="#group-attribute-auth_membership">auth_membership</a> => <em># Configures the behavior of the `members...</em>
<a href="#group-attribute-forcelocal">forcelocal</a> => <em># Forces the management of local accounts when...</em>
<a href="#group-attribute-gid">gid</a> => <em># The group ID. Must be specified numerically....</em>
<a href="#group-attribute-ia_load_module">ia_load_module</a> => <em># The name of the I&A module to use to manage this </em>
<a href="#group-attribute-members">members</a> => <em># The members of the group. For platforms or...</em>
<a href="#group-attribute-provider">provider</a> => <em># The specific backend to use for this `group...</em>
<a href="#group-attribute-system">system</a> => <em># Whether the group is a system group with lower...</em>
# ...plus any applicable <a href="https://puppet.com/docs/puppet/latest/metaparameter.html">metaparameters</a>.
}</code></pre>
#### name {#group-attribute-name}
_(**Namevar:** If omitted, this attribute's value defaults to the resource's title.)_
The group name. While naming limitations vary by operating system,
it is advisable to restrict names to the lowest common denominator,
which is a maximum of 8 characters beginning with a letter.
Note that Puppet considers group names to be case-sensitive, regardless
of the platform's own rules; be sure to always use the same case when
referring to a given group.
([↑ Back to group attributes](#group-attributes))
#### ensure {#group-attribute-ensure}
_(**Property:** This attribute represents concrete state on the target system.)_
Create or remove the group.
Valid values are `present`, `absent`.
([↑ Back to group attributes](#group-attributes))
#### allowdupe {#group-attribute-allowdupe}
Whether to allow duplicate GIDs.
Valid values are `true`, `false`, `yes`, `no`.
([↑ Back to group attributes](#group-attributes))
#### attribute_membership {#group-attribute-attribute_membership}
AIX only. Configures the behavior of the `attributes` parameter.
* `minimum` (default) --- The provided list of attributes is partial, and Puppet
**ignores** any attributes that aren't listed there.
* `inclusive` --- The provided list of attributes is comprehensive, and
Puppet **purges** any attributes that aren't listed there.
Valid values are `inclusive`, `minimum`.
([↑ Back to group attributes](#group-attributes))
#### attributes {#group-attribute-attributes}
_(**Property:** This attribute represents concrete state on the target system.)_
Specify group AIX attributes, as an array of `'key=value'` strings. This
parameter's behavior can be configured with `attribute_membership`.
Requires features manages_aix_lam.
([↑ Back to group attributes](#group-attributes))
#### auth_membership {#group-attribute-auth_membership}
Configures the behavior of the `members` parameter.
* `false` (default) --- The provided list of group members is partial,
and Puppet **ignores** any members that aren't listed there.
* `true` --- The provided list of of group members is comprehensive, and
Puppet **purges** any members that aren't listed there.
Valid values are `true`, `false`, `yes`, `no`.
([↑ Back to group attributes](#group-attributes))
#### forcelocal {#group-attribute-forcelocal}
Forces the management of local accounts when accounts are also
being managed by some other Name Switch Service (NSS). For AIX, refer to the `ia_load_module` parameter.
This option relies on your operating system's implementation of `luser*` commands, such as `luseradd` , `lgroupadd`, and `lusermod`. The `forcelocal` option could behave unpredictably in some circumstances. If the tools it depends on are not available, it might have no effect at all.
Valid values are `true`, `false`, `yes`, `no`.
Requires features manages_local_users_and_groups.
([↑ Back to group attributes](#group-attributes))
#### gid {#group-attribute-gid}
_(**Property:** This attribute represents concrete state on the target system.)_
The group ID. Must be specified numerically. If no group ID is
specified when creating a new group, then one will be chosen
automatically according to local system standards. This will likely
result in the same group having different GIDs on different systems,
which is not recommended.
On Windows, this property is read-only and will return the group's security
identifier (SID).
([↑ Back to group attributes](#group-attributes))
#### ia_load_module {#group-attribute-ia_load_module}
The name of the I&A module to use to manage this group.
This should be set to `files` if managing local groups.
Requires features manages_aix_lam.
([↑ Back to group attributes](#group-attributes))
#### members {#group-attribute-members}
_(**Property:** This attribute represents concrete state on the target system.)_
The members of the group. For platforms or directory services where group
membership is stored in the group objects, not the users. This parameter's
behavior can be configured with `auth_membership`.
Requires features manages_members.
([↑ Back to group attributes](#group-attributes))
#### provider {#group-attribute-provider}
The specific backend to use for this `group`
resource. You will seldom need to specify this --- Puppet will usually
discover the appropriate provider for your platform.
Available providers are:
* [`aix`](#group-provider-aix)
* [`directoryservice`](#group-provider-directoryservice)
* [`groupadd`](#group-provider-groupadd)
* [`ldap`](#group-provider-ldap)
* [`pw`](#group-provider-pw)
* [`windows_adsi`](#group-provider-windows_adsi)
([↑ Back to group attributes](#group-attributes))
#### system {#group-attribute-system}
Whether the group is a system group with lower GID.
Valid values are `true`, `false`, `yes`, `no`.
([↑ Back to group attributes](#group-attributes))
### Providers {#group-providers}
#### aix {#group-provider-aix}
Group management for AIX.
* Required binaries: `/usr/bin/chgroup`, `/usr/bin/mkgroup`, `/usr/sbin/lsgroup`, `/usr/sbin/rmgroup`.
* Default for `os.name` == `aix`.
* Supported features: `manages_aix_lam`, `manages_local_users_and_groups`, `manages_members`.
#### directoryservice {#group-provider-directoryservice}
Group management using DirectoryService on OS X.
* Required binaries: `/usr/bin/dscl`.
* Default for `os.name` == `darwin`.
* Supported features: `manages_members`.
#### groupadd {#group-provider-groupadd}
Group management via `groupadd` and its ilk. The default for most platforms.
To use the `forcelocal` parameter, you need to install the `libuser` package (providing
`/usr/sbin/lgroupadd` and `/usr/sbin/luseradd`).
* Required binaries: `groupadd`, `groupdel`, `groupmod`, `lgroupadd`, `lgroupdel`, `lgroupmod`, `usermod`.
* Supported features: `system_groups`.
#### ldap {#group-provider-ldap}
Group management via LDAP.
This provider requires that you have valid values for all of the
LDAP-related settings in `puppet.conf`, including `ldapbase`. You will
almost definitely need settings for `ldapuser` and `ldappassword` in order
for your clients to write to LDAP.
Note that this provider will automatically generate a GID for you if you do
not specify one, but it is a potentially expensive operation, as it
iterates across all existing groups to pick the appropriate next one.
#### pw {#group-provider-pw}
Group management via `pw` on FreeBSD and DragonFly BSD.
* Required binaries: `pw`.
* Default for `os.name` == `freebsd, dragonfly`.
* Supported features: `manages_members`.
#### windows_adsi {#group-provider-windows_adsi}
Local group management for Windows. Group members can be both users and groups.
Additionally, local groups can contain domain users.
* Default for `os.name` == `windows`.
* Supported features: `manages_members`.
### Provider Features {#group-provider-features}
Available features:
* `manages_aix_lam` --- The provider can manage AIX Loadable Authentication Module (LAM) system.
* `manages_local_users_and_groups` --- Allows local groups to be managed on systems that also use some other remote Name Switch Service (NSS) method of managing accounts.
* `manages_members` --- For directories where membership is an attribute of groups not users.
* `system_groups` --- The provider allows you to create system groups with lower GIDs.
Provider support:
* **aix** - _manages aix lam, manages local users and groups, manages members_
* **directoryservice** - _manages members_
* **groupadd** - _system groups, libuser_
* **ldap** - No supported Provider features
* **pw** - _manages members_
* **windows_adsi** - _manages members_
---------
## notify
* [Attributes](#notify-attributes)
### Description {#notify-description}
Sends an arbitrary message, specified as a string, to the agent run-time log. It's important to note that the notify resource type is not idempotent. As a result, notifications are shown as a change on every Puppet run.
### Attributes {#notify-attributes}
<pre><code>notify { 'resource title':
<a href="#notify-attribute-name">name</a> => <em># <strong>(namevar)</strong> An arbitrary tag for your own reference; the...</em>
<a href="#notify-attribute-message">message</a> => <em># The message to be sent to the log. Note that the </em>
<a href="#notify-attribute-withpath">withpath</a> => <em># Whether to show the full object path. Valid...</em>
# ...plus any applicable <a href="https://puppet.com/docs/puppet/latest/metaparameter.html">metaparameters</a>.
}</code></pre>
#### name {#notify-attribute-name}
_(**Namevar:** If omitted, this attribute's value defaults to the resource's title.)_
An arbitrary tag for your own reference; the name of the message.
([↑ Back to notify attributes](#notify-attributes))
#### message {#notify-attribute-message}
_(**Property:** This attribute represents concrete state on the target system.)_
The message to be sent to the log. Note that the value specified must be a string.
([↑ Back to notify attributes](#notify-attributes))
#### withpath {#notify-attribute-withpath}
Whether to show the full object path.
Valid values are `true`, `false`.
([↑ Back to notify attributes](#notify-attributes))
---------
## package
* [Attributes](#package-attributes)
* [Providers](#package-providers)
* [Provider Features](#package-provider-features)
### Description {#package-description}
Manage packages. There is a basic dichotomy in package
support right now: Some package types (such as yum and apt) can
retrieve their own package files, while others (such as rpm and sun)
cannot. For those package formats that cannot retrieve their own files,
you can use the `source` parameter to point to the correct file.
Puppet will automatically guess the packaging format that you are
using based on the platform you are on, but you can override it
using the `provider` parameter; each provider defines what it
requires in order to function, and you must meet those requirements
to use a given provider.
You can declare multiple package resources with the same `name` as long
as they have unique titles, and specify different providers and commands.
Note that you must use the _title_ to make a reference to a package
resource; `Package[<NAME>]` is not a synonym for `Package[<TITLE>]` like
it is for many other resource types.
**Autorequires:** If Puppet is managing the files specified as a
package's `adminfile`, `responsefile`, or `source`, the package
resource will autorequire those files.
### Attributes {#package-attributes}
<pre><code>package { 'resource title':
<a href="#package-attribute-name">name</a> => <em># <strong>(namevar)</strong> The package name. This is the name that the...</em>
<a href="#package-attribute-provider">provider</a> => <em># <strong>(namevar)</strong> The specific backend to use for this `package...</em>
<a href="#package-attribute-command">command</a> => <em># <strong>(namevar)</strong> The targeted command to use when managing a...</em>
<a href="#package-attribute-ensure">ensure</a> => <em># What state the package should be in. On...</em>
<a href="#package-attribute-adminfile">adminfile</a> => <em># A file containing package defaults for...</em>
<a href="#package-attribute-allow_virtual">allow_virtual</a> => <em># Specifies if virtual package names are allowed...</em>
<a href="#package-attribute-allowcdrom">allowcdrom</a> => <em># Tells apt to allow cdrom sources in the...</em>
<a href="#package-attribute-category">category</a> => <em># A read-only parameter set by the...</em>
<a href="#package-attribute-configfiles">configfiles</a> => <em># Whether to keep or replace modified config files </em>
<a href="#package-attribute-description">description</a> => <em># A read-only parameter set by the...</em>
<a href="#package-attribute-enable_only">enable_only</a> => <em># Tells `dnf module` to only enable a specific...</em>
<a href="#package-attribute-flavor">flavor</a> => <em># OpenBSD and DNF modules support 'flavors', which </em>
<a href="#package-attribute-install_only">install_only</a> => <em># It should be set for packages that should only...</em>
<a href="#package-attribute-install_options">install_options</a> => <em># An array of additional options to pass when...</em>
<a href="#package-attribute-instance">instance</a> => <em># A read-only parameter set by the...</em>
<a href="#package-attribute-mark">mark</a> => <em># Set to hold to tell Debian apt/Solaris pkg to...</em>
<a href="#package-attribute-package_settings">package_settings</a> => <em># Settings that can change the contents or...</em>
<a href="#package-attribute-platform">platform</a> => <em># A read-only parameter set by the...</em>
<a href="#package-attribute-reinstall_on_refresh">reinstall_on_refresh</a> => <em># Whether this resource should respond to refresh...</em>
<a href="#package-attribute-responsefile">responsefile</a> => <em># A file containing any necessary answers to...</em>
<a href="#package-attribute-root">root</a> => <em># A read-only parameter set by the...</em>
<a href="#package-attribute-source">source</a> => <em># Where to find the package file. This is mostly...</em>
<a href="#package-attribute-status">status</a> => <em># A read-only parameter set by the...</em>
<a href="#package-attribute-uninstall_options">uninstall_options</a> => <em># An array of additional options to pass when...</em>
<a href="#package-attribute-vendor">vendor</a> => <em># A read-only parameter set by the...</em>
# ...plus any applicable <a href="https://puppet.com/docs/puppet/latest/metaparameter.html">metaparameters</a>.
}</code></pre>
#### name {#package-attribute-name}
_(**Namevar:** If omitted, this attribute's value defaults to the resource's title.)_
The package name. This is the name that the packaging
system uses internally, which is sometimes (especially on Solaris)
a name that is basically useless to humans. If a package goes by
several names, you can use a single title and then set the name
conditionally:
# In the 'openssl' class
$ssl = $os['name'] ? {
solaris => SMCossl,
default => openssl
}
package { 'openssl':
ensure => installed,
name => $ssl,
}
...
$ssh = $os['name'] ? {
solaris => SMCossh,
default => openssh
}
package { 'openssh':
ensure => installed,
name => $ssh,
require => Package['openssl'],
}
([↑ Back to package attributes](#package-attributes))
#### provider {#package-attribute-provider}
_(**Secondary namevar:** This resource type allows you to manage multiple resources with the same name as long as their providers are different.)_
The specific backend to use for this `package`
resource. You will seldom need to specify this --- Puppet will usually
discover the appropriate provider for your platform.
Available providers are:
* [`aix`](#package-provider-aix)
* [`appdmg`](#package-provider-appdmg)
* [`apple`](#package-provider-apple)
* [`apt`](#package-provider-apt)
* [`aptitude`](#package-provider-aptitude)
* [`aptrpm`](#package-provider-aptrpm)
* [`blastwave`](#package-provider-blastwave)
* [`dnf`](#package-provider-dnf)
* [`dnfmodule`](#package-provider-dnfmodule)
* [`dpkg`](#package-provider-dpkg)
* [`fink`](#package-provider-fink)
* [`freebsd`](#package-provider-freebsd)
* [`gem`](#package-provider-gem)
* [`hpux`](#package-provider-hpux)
* [`macports`](#package-provider-macports)
* [`nim`](#package-provider-nim)
* [`openbsd`](#package-provider-openbsd)
* [`opkg`](#package-provider-opkg)
* [`pacman`](#package-provider-pacman)
* [`pip2`](#package-provider-pip2)
* [`pip3`](#package-provider-pip3)
* [`pip`](#package-provider-pip)
* [`pkg`](#package-provider-pkg)
* [`pkgdmg`](#package-provider-pkgdmg)
* [`pkgin`](#package-provider-pkgin)
* [`pkgng`](#package-provider-pkgng)
* [`pkgutil`](#package-provider-pkgutil)
* [`portage`](#package-provider-portage)
* [`ports`](#package-provider-ports)
* [`portupgrade`](#package-provider-portupgrade)
* [`puppet_gem`](#package-provider-puppet_gem)
* [`puppetserver_gem`](#package-provider-puppetserver_gem)
* [`rpm`](#package-provider-rpm)
* [`rug`](#package-provider-rug)
* [`sun`](#package-provider-sun)
* [`sunfreeware`](#package-provider-sunfreeware)
* [`tdnf`](#package-provider-tdnf)
* [`up2date`](#package-provider-up2date)
* [`urpmi`](#package-provider-urpmi)
* [`windows`](#package-provider-windows)
* [`xbps`](#package-provider-xbps)
* [`yum`](#package-provider-yum)
* [`zypper`](#package-provider-zypper)
([↑ Back to package attributes](#package-attributes))
#### command {#package-attribute-command}
_(**Namevar:** If omitted, this attribute's value defaults to the resource's title.)_
The targeted command to use when managing a package:
package { 'mysql':
provider => gem,
}
package { 'mysql-opt':
name => 'mysql',
provider => gem,
command => '/opt/ruby/bin/gem',
}
Each provider defines a package management command and uses the first
instance of the command found in the PATH.
Providers supporting the targetable feature allow you to specify the
absolute path of the package management command. Specifying the absolute
path is useful when multiple instances of the command are installed, or
the command is not in the PATH.
Requires features targetable.
([↑ Back to package attributes](#package-attributes))
#### ensure {#package-attribute-ensure}
_(**Property:** This attribute represents concrete state on the target system.)_
What state the package should be in. On packaging systems that can
retrieve new packages on their own, you can choose which package to
retrieve by specifying a version number or `latest` as the ensure
value. On packaging systems that manage configuration files separately
from "normal" system files, you can uninstall config files by
specifying `purged` as the ensure value. This defaults to `installed`.
Version numbers must match the full version to install, including
release if the provider uses a release moniker. For
example, to install the bash package from the rpm
`bash-4.1.2-29.el6.x86_64.rpm`, use the string `'4.1.2-29.el6'`.
On supported providers, version ranges can also be ensured. For example,
inequalities: `<2.0.0`, or intersections: `>1.0.0 <2.0.0`.
Valid values are `present` (also called `installed`), `absent`, `purged`, `disabled`, `latest`. Values can match `/./`.
([↑ Back to package attributes](#package-attributes))
#### adminfile {#package-attribute-adminfile}
A file containing package defaults for installing packages.
This attribute is only used on Solaris. Its value should be a path to a
local file stored on the target system. Solaris's package tools expect
either an absolute file path or a relative path to a file in
`/var/sadm/install/admin`.
The value of `adminfile` will be passed directly to the `pkgadd` or
`pkgrm` command with the `-a <ADMINFILE>` option.
([↑ Back to package attributes](#package-attributes))
#### allow_virtual {#package-attribute-allow_virtual}
Specifies if virtual package names are allowed for install and uninstall.
Valid values are `true`, `false`, `yes`, `no`.
Requires features virtual_packages.
([↑ Back to package attributes](#package-attributes))
#### allowcdrom {#package-attribute-allowcdrom}
Tells apt to allow cdrom sources in the sources.list file.
Normally apt will bail if you try this.
Valid values are `true`, `false`.
([↑ Back to package attributes](#package-attributes))
#### category {#package-attribute-category}
A read-only parameter set by the package.
([↑ Back to package attributes](#package-attributes))
#### configfiles {#package-attribute-configfiles}
Whether to keep or replace modified config files when installing or
upgrading a package. This only affects the `apt` and `dpkg` providers.
Valid values are `keep`, `replace`.
([↑ Back to package attributes](#package-attributes))
#### description {#package-attribute-description}
A read-only parameter set by the package.
([↑ Back to package attributes](#package-attributes))
#### enable_only {#package-attribute-enable_only}
Tells `dnf module` to only enable a specific module, instead
of installing its default profile.
Modules with no default profile will be enabled automatically
without the use of this parameter.
Conflicts with the `flavor` property, which selects a profile
to install.
Valid values are `true`, `false`, `yes`, `no`.
([↑ Back to package attributes](#package-attributes))
#### flavor {#package-attribute-flavor}
_(**Property:** This attribute represents concrete state on the target system.)_
OpenBSD and DNF modules support 'flavors', which are
further specifications for which type of package you want.
Requires features supports_flavors.
([↑ Back to package attributes](#package-attributes))
#### install_only {#package-attribute-install_only}
It should be set for packages that should only ever be installed,
never updated. Kernels in particular fall into this category.
Valid values are `true`, `false`, `yes`, `no`.
Requires features install_only.
([↑ Back to package attributes](#package-attributes))
#### install_options {#package-attribute-install_options}
An array of additional options to pass when installing a package. These
options are package-specific, and should be documented by the software
vendor. One commonly implemented option is `INSTALLDIR`:
package { 'mysql':
ensure => installed,
source => 'N:/packages/mysql-5.5.16-winx64.msi',
install_options => [ '/S', { 'INSTALLDIR' => 'C:\mysql-5.5' } ],
}
Each option in the array can either be a string or a hash, where each
key and value pair are interpreted in a provider specific way. Each
option will automatically be quoted when passed to the install command.
With Windows packages, note that file paths in an install option must
use backslashes. (Since install options are passed directly to the
installation command, forward slashes won't be automatically converted
like they are in `file` resources.) Note also that backslashes in
double-quoted strings _must_ be escaped and backslashes in single-quoted
strings _can_ be escaped.
Requires features install_options.
([↑ Back to package attributes](#package-attributes))
#### instance {#package-attribute-instance}
A read-only parameter set by the package.
([↑ Back to package attributes](#package-attributes))
#### mark {#package-attribute-mark}
_(**Property:** This attribute represents concrete state on the target system.)_
Set to hold to tell Debian apt/Solaris pkg to hold the package version
Valid values are: hold/none
Default is "none". Mark can be specified with or without `ensure`,
if `ensure` is missing will default to "present".
Mark cannot be specified together with "purged", or "absent"
values for `ensure`.
Valid values are `hold`, `none`.
Requires features holdable.
([↑ Back to package attributes](#package-attributes))
#### package_settings {#package-attribute-package_settings}
_(**Property:** This attribute represents concrete state on the target system.)_
Settings that can change the contents or configuration of a package.
The formatting and effects of package_settings are provider-specific; any
provider that implements them must explain how to use them in its
documentation. (Our general expectation is that if a package is
installed but its settings are out of sync, the provider should
re-install that package with the desired settings.)
An example of how package_settings could be used is FreeBSD's port build
options --- a future version of the provider could accept a hash of options,
and would reinstall the port if the installed version lacked the correct
settings.
package { 'www/apache22':
package_settings => { 'SUEXEC' => false }
}
Again, check the documentation of your platform's package provider to see
the actual usage.
Requires features package_settings.
([↑ Back to package attributes](#package-attributes))
#### platform {#package-attribute-platform}
A read-only parameter set by the package.
([↑ Back to package attributes](#package-attributes))
#### reinstall_on_refresh {#package-attribute-reinstall_on_refresh}
Whether this resource should respond to refresh events (via `subscribe`,
`notify`, or the `~>` arrow) by reinstalling the package. Only works for
providers that support the `reinstallable` feature.
This is useful for source-based distributions, where you may want to
recompile a package if the build options change.
If you use this, be careful of notifying classes when you want to restart
services. If the class also contains a refreshable package, doing so could
cause unnecessary re-installs.
Valid values are `true`, `false`.
([↑ Back to package attributes](#package-attributes))
#### responsefile {#package-attribute-responsefile}
A file containing any necessary answers to questions asked by
the package. This is currently used on Solaris and Debian. The
value will be validated according to system rules, but it should
generally be a fully qualified path.
([↑ Back to package attributes](#package-attributes))
#### root {#package-attribute-root}
A read-only parameter set by the package.
([↑ Back to package attributes](#package-attributes))
#### source {#package-attribute-source}
Where to find the package file. This is mostly used by providers that don't
automatically download packages from a central repository. (For example:
the `yum` provider ignores this attribute, `apt` provider uses it if present
and the `rpm` and `dpkg` providers require it.)
Different providers accept different values for `source`. Most providers
accept paths to local files stored on the target system. Some providers
may also accept URLs or network drive paths. Puppet will not
automatically retrieve source files for you, and usually just passes the
value of `source` to the package installation command.
You can use a `file` resource if you need to manually copy package files
to the target system.
([↑ Back to package attributes](#package-attributes))
#### status {#package-attribute-status}
A read-only parameter set by the package.
([↑ Back to package attributes](#package-attributes))
#### uninstall_options {#package-attribute-uninstall_options}
An array of additional options to pass when uninstalling a package. These
options are package-specific, and should be documented by the software
vendor. For example:
package { 'VMware Tools':
ensure => absent,
uninstall_options => [ { 'REMOVE' => 'Sync,VSS' } ],
}
Each option in the array can either be a string or a hash, where each
key and value pair are interpreted in a provider specific way. Each
option will automatically be quoted when passed to the uninstall
command.
On Windows, this is the **only** place in Puppet where backslash
separators should be used. Note that backslashes in double-quoted
strings _must_ be double-escaped and backslashes in single-quoted
strings _may_ be double-escaped.
Requires features uninstall_options.
([↑ Back to package attributes](#package-attributes))
#### vendor {#package-attribute-vendor}
A read-only parameter set by the package.
([↑ Back to package attributes](#package-attributes))
### Providers {#package-providers}
#### aix {#package-provider-aix}
Installation from an AIX software directory, using the AIX `installp`
command. The `source` parameter is required for this provider, and should
be set to the absolute path (on the puppet agent machine) of a directory
containing one or more BFF package files.
The `installp` command will generate a table of contents file (named `.toc`)
in this directory, and the `name` parameter (or resource title) that you
specify for your `package` resource must match a package name that exists
in the `.toc` file.
Note that package downgrades are *not* supported; if your resource specifies
a specific version number and there is already a newer version of the package
installed on the machine, the resource will fail with an error message.
* Required binaries: `/usr/bin/lslpp`, `/usr/sbin/installp`.
* Default for `os.name` == `aix`.
* Supported features: `installable`, `uninstallable`, `upgradeable`, `versionable`.
#### appdmg {#package-provider-appdmg}
Package management which copies application bundles to a target.
* Required binaries: `/usr/bin/curl`, `/usr/bin/ditto`, `/usr/bin/hdiutil`.
* Supported features: `installable`.
#### apple {#package-provider-apple}
Package management based on OS X's built-in packaging system. This is
essentially the simplest and least functional package system in existence --
it only supports installation; no deletion or upgrades. The provider will
automatically add the `.pkg` extension, so leave that off when specifying
the package name.
* Required binaries: `/usr/sbin/installer`.
* Supported features: `installable`.
#### apt {#package-provider-apt}
Package management via `apt-get`.
This provider supports the `install_options` attribute, which allows command-line flags to be passed to apt-get.
These options should be specified as an array where each element is either a
string or a hash.
* Required binaries: `/usr/bin/apt-cache`, `/usr/bin/apt-get`, `/usr/bin/apt-mark`, `/usr/bin/debconf-set-selections`.
* Default for `os.family` == `debian`.
* Supported features: `holdable`, `install_options`, `installable`, `purgeable`, `uninstallable`, `upgradeable`, `version_ranges`, `versionable`, `virtual_packages`.
#### aptitude {#package-provider-aptitude}
Package management via `aptitude`.
* Required binaries: `/usr/bin/apt-cache`, `/usr/bin/aptitude`.
* Supported features: `holdable`, `installable`, `purgeable`, `uninstallable`, `upgradeable`, `versionable`.
#### aptrpm {#package-provider-aptrpm}
Package management via `apt-get` ported to `rpm`.
* Required binaries: `apt-cache`, `apt-get`, `rpm`.
* Supported features: `installable`, `purgeable`, `uninstallable`, `upgradeable`, `versionable`.
#### blastwave {#package-provider-blastwave}
Package management using Blastwave.org's `pkg-get` command on Solaris.
* Required binaries: `pkg-get`.
* Supported features: `installable`, `uninstallable`, `upgradeable`.
#### dnf {#package-provider-dnf}
Support via `dnf`.
Using this provider's `uninstallable` feature will not remove dependent packages. To
remove dependent packages with this provider use the `purgeable` feature, but note this
feature is destructive and should be used with the utmost care.
This provider supports the `install_options` attribute, which allows command-line flags to be passed to dnf.
These options should be specified as an array where each element is either
a string or a hash.
* Required binaries: `dnf`, `rpm`.
* Default for `os.name` == `fedora`. Default for `os.family` == `redhat`. Default for `os.name` == `amazon` and `os.release.major` == `2023`.
* Supported features: `install_only`, `install_options`, `installable`, `purgeable`, `uninstallable`, `upgradeable`, `version_ranges`, `versionable`, `virtual_packages`.
#### dnfmodule {#package-provider-dnfmodule}
* Required binaries: `/usr/bin/dnf`.
* Supported features: `disableable`, `installable`, `purgeable`, `supports_flavors`, `uninstallable`, `upgradeable`, `versionable`.
#### dpkg {#package-provider-dpkg}
Package management via `dpkg`. Because this only uses `dpkg`
and not `apt`, you must specify the source of any packages you want
to manage.
* Required binaries: `/usr/bin/dpkg-deb`, `/usr/bin/dpkg-query`, `/usr/bin/dpkg`.
* Supported features: `holdable`, `installable`, `purgeable`, `uninstallable`, `upgradeable`, `virtual_packages`.
#### fink {#package-provider-fink}
Package management via `fink`.
* Required binaries: `/sw/bin/apt-cache`, `/sw/bin/apt-get`, `/sw/bin/dpkg-query`, `/sw/bin/fink`.
* Supported features: `holdable`, `installable`, `purgeable`, `uninstallable`, `upgradeable`, `versionable`.
#### freebsd {#package-provider-freebsd}
The specific form of package management on FreeBSD. This is an
extremely quirky packaging system, in that it freely mixes between
ports and packages. Apparently all of the tools are written in Ruby,
so there are plans to rewrite this support to directly use those
libraries.
* Required binaries: `/usr/sbin/pkg_add`, `/usr/sbin/pkg_delete`, `/usr/sbin/pkg_info`.
* Supported features: `installable`, `purgeable`, `uninstallable`, `upgradeable`.
#### gem {#package-provider-gem}
Ruby Gem support. If a URL is passed via `source`, then that URL is
appended to the list of remote gem repositories; to ensure that only the
specified source is used, also pass `--clear-sources` via `install_options`.
If source is present but is not a valid URL, it will be interpreted as the
path to a local gem file. If source is not present, the gem will be
installed from the default gem repositories. Note that to modify this for Windows, it has to be a valid URL.
This provider supports the `install_options` and `uninstall_options` attributes,
which allow command-line flags to be passed to the gem command.
These options should be specified as an array where each element is either a
string or a hash.
* Required binaries: `gem`.
* Supported features: `install_options`, `installable`, `targetable`, `uninstall_options`, `uninstallable`, `upgradeable`, `version_ranges`, `versionable`.
#### hpux {#package-provider-hpux}
HP-UX's packaging system.
* Required binaries: `/usr/sbin/swinstall`, `/usr/sbin/swlist`, `/usr/sbin/swremove`.
* Default for `os.name` == `hp-ux`.
* Supported features: `installable`, `uninstallable`.
#### macports {#package-provider-macports}
Package management using MacPorts on OS X.
Supports MacPorts versions and revisions, but not variants.
Variant preferences may be specified using
[the MacPorts variants.conf file](http://guide.macports.org/chunked/internals.configuration-files.html#internals.configuration-files.variants-conf).
When specifying a version in the Puppet DSL, only specify the version, not the revision.
Revisions are only used internally for ensuring the latest version/revision of a port.
* Required binaries: `/opt/local/bin/port`.
* Supported features: `installable`, `uninstallable`, `upgradeable`, `versionable`.
#### nim {#package-provider-nim}
Installation from an AIX NIM LPP source. The `source` parameter is required
for this provider, and should specify the name of a NIM `lpp_source` resource
that is visible to the puppet agent machine. This provider supports the
management of both BFF/installp and RPM packages.
Note that package downgrades are *not* supported; if your resource specifies
a specific version number and there is already a newer version of the package
installed on the machine, the resource will fail with an error message.
* Required binaries: `/usr/bin/lslpp`, `/usr/sbin/nimclient`, `rpm`.
* Supported features: `installable`, `uninstallable`, `upgradeable`, `versionable`.
#### openbsd {#package-provider-openbsd}
OpenBSD's form of `pkg_add` support.
This provider supports the `install_options` and `uninstall_options`
attributes, which allow command-line flags to be passed to pkg_add and pkg_delete.
These options should be specified as an array where each element is either a
string or a hash.
* Required binaries: `pkg_add`, `pkg_delete`, `pkg_info`.
* Default for `os.name` == `openbsd`.
* Supported features: `install_options`, `installable`, `purgeable`, `supports_flavors`, `uninstall_options`, `uninstallable`, `upgradeable`, `versionable`.
#### opkg {#package-provider-opkg}
Opkg packaging support. Common on OpenWrt and OpenEmbedded platforms
* Required binaries: `opkg`.
* Default for `os.name` == `openwrt`.
* Supported features: `installable`, `uninstallable`, `upgradeable`.
#### pacman {#package-provider-pacman}
Support for the Package Manager Utility (pacman) used in Archlinux.
This provider supports the `install_options` attribute, which allows command-line flags to be passed to pacman.
These options should be specified as an array where each element is either a string or a hash.
* Required binaries: `/usr/bin/pacman`.
* Default for `os.name` == `archlinux, manjarolinux, artix`.
* Supported features: `install_options`, `installable`, `purgeable`, `uninstall_options`, `uninstallable`, `upgradeable`, `virtual_packages`.
#### pip {#package-provider-pip}
Python packages via `pip`.
This provider supports the `install_options` attribute, which allows command-line flags to be passed to pip.
These options should be specified as an array where each element is either a string or a hash.
* Supported features: `install_options`, `installable`, `targetable`, `uninstallable`, `upgradeable`, `version_ranges`, `versionable`.
#### pip2 {#package-provider-pip2}
Python packages via `pip2`.
This provider supports the `install_options` attribute, which allows command-line flags to be passed to pip2.
These options should be specified as an array where each element is either a string or a hash.
* Supported features: `install_options`, `installable`, `targetable`, `uninstallable`, `upgradeable`, `versionable`.
#### pip3 {#package-provider-pip3}
Python packages via `pip3`.
This provider supports the `install_options` attribute, which allows command-line flags to be passed to pip3.
These options should be specified as an array where each element is either a string or a hash.
* Supported features: `install_options`, `installable`, `targetable`, `uninstallable`, `upgradeable`, `versionable`.
#### pkg {#package-provider-pkg}
OpenSolaris image packaging system. See pkg(5) for more information.
This provider supports the `install_options` attribute, which allows
command-line flags to be passed to pkg. These options should be specified as an
array where each element is either a string or a hash.
* Required binaries: `/usr/bin/pkg`.
* Default for `kernelrelease` == `5.11, 5.12` and `os.family` == `solaris`.
* Supported features: `holdable`, `install_options`, `installable`, `uninstallable`, `upgradeable`, `versionable`.
#### pkgdmg {#package-provider-pkgdmg}
Package management based on Apple's Installer.app and DiskUtility.app.
This provider works by checking the contents of a DMG image for Apple pkg or
mpkg files. Any number of pkg or mpkg files may exist in the root directory
of the DMG file system, and Puppet will install all of them. Subdirectories
are not checked for packages.
This provider can also accept plain .pkg (but not .mpkg) files in addition
to .dmg files.
Notes:
* The `source` attribute is mandatory. It must be either a local disk path
or an HTTP, HTTPS, or FTP URL to the package.
* The `name` of the resource must be the filename (without path) of the DMG file.
* When installing the packages from a DMG, this provider writes a file to
disk at `/var/db/.puppet_pkgdmg_installed_NAME`. If that file is present,
Puppet assumes all packages from that DMG are already installed.
* This provider is not versionable and uses DMG filenames to determine
whether a package has been installed. Thus, to install new a version of a
package, you must create a new DMG with a different filename.
* Required binaries: `/usr/bin/curl`, `/usr/bin/hdiutil`, `/usr/sbin/installer`.
* Default for `os.name` == `darwin`.
* Supported features: `installable`.
#### pkgin {#package-provider-pkgin}
Package management using pkgin, a binary package manager for pkgsrc.
* Required binaries: `pkgin`.
* Default for `os.name` == `smartos, netbsd`.
* Supported features: `installable`, `uninstallable`, `upgradeable`, `versionable`.
#### pkgng {#package-provider-pkgng}
A PkgNG provider for FreeBSD and DragonFly.
* Required binaries: `/usr/local/sbin/pkg`.
* Default for `os.name` == `freebsd, dragonfly`.
* Supported features: `install_options`, `installable`, `uninstallable`, `upgradeable`, `versionable`.
#### pkgutil {#package-provider-pkgutil}
Package management using Peter Bonivart's ``pkgutil`` command on Solaris.
* Required binaries: `pkgutil`.
* Supported features: `installable`, `uninstallable`, `upgradeable`.
#### portage {#package-provider-portage}
Provides packaging support for Gentoo's portage system.
This provider supports the `install_options` and `uninstall_options` attributes, which allows command-line
flags to be passed to emerge. These options should be specified as an array where each element is either a string or a hash.
* Required binaries: `/usr/bin/eix-update`, `/usr/bin/eix`, `/usr/bin/emerge`, `/usr/bin/qatom`.
* Default for `os.family` == `gentoo`.
* Supported features: `install_options`, `installable`, `purgeable`, `reinstallable`, `uninstall_options`, `uninstallable`, `upgradeable`, `versionable`, `virtual_packages`.
#### ports {#package-provider-ports}
Support for FreeBSD's ports. Note that this, too, mixes packages and ports.
* Required binaries: `/usr/local/sbin/pkg_deinstall`, `/usr/local/sbin/portupgrade`, `/usr/local/sbin/portversion`, `/usr/sbin/pkg_info`.
* Supported features: `installable`, `purgeable`, `uninstallable`, `upgradeable`.
#### portupgrade {#package-provider-portupgrade}
Support for FreeBSD's ports using the portupgrade ports management software.
Use the port's full origin as the resource name. eg (ports-mgmt/portupgrade)
for the portupgrade port.
* Required binaries: `/usr/local/sbin/pkg_deinstall`, `/usr/local/sbin/portinstall`, `/usr/local/sbin/portupgrade`, `/usr/local/sbin/portversion`, `/usr/sbin/pkg_info`.
* Supported features: `installable`, `uninstallable`, `upgradeable`.
#### puppet_gem {#package-provider-puppet_gem}
Puppet Ruby Gem support. This provider is useful for managing
gems needed by the ruby provided in the puppet-agent package.
* Required binaries: `/opt/puppetlabs/puppet/bin/gem`.
* Supported features: `install_options`, `installable`, `uninstall_options`, `uninstallable`, `upgradeable`, `versionable`.
#### puppetserver_gem {#package-provider-puppetserver_gem}
Puppet Server Ruby Gem support. If a URL is passed via `source`, then
that URL is appended to the list of remote gem repositories which by default
contains rubygems.org; To ensure that only the specified source is used also
pass `--clear-sources` in via `install_options`; if a source is present but
is not a valid URL, it will be interpreted as the path to a local gem file.
If source is not present at all, the gem will be installed from the default
gem repositories.
* Required binaries: `/opt/puppetlabs/bin/puppetserver`.
* Supported features: `install_options`, `installable`, `uninstall_options`, `uninstallable`, `upgradeable`, `versionable`.
#### rpm {#package-provider-rpm}
RPM packaging support; should work anywhere with a working `rpm`
binary.
This provider supports the `install_options` and `uninstall_options`
attributes, which allow command-line flags to be passed to rpm.
These options should be specified as an array where each element is either a string or a hash.
* Required binaries: `rpm`.
* Supported features: `install_only`, `install_options`, `installable`, `uninstall_options`, `uninstallable`, `upgradeable`, `versionable`, `virtual_packages`.
#### rug {#package-provider-rug}
Support for suse `rug` package manager.
* Required binaries: `/usr/bin/rug`, `rpm`.
* Supported features: `installable`, `uninstallable`, `upgradeable`, `versionable`.
#### sun {#package-provider-sun}
Sun's packaging system. Requires that you specify the source for
the packages you're managing.
This provider supports the `install_options` attribute, which allows command-line flags to be passed to pkgadd.
These options should be specified as an array where each element is either a string
or a hash.
* Required binaries: `/usr/bin/pkginfo`, `/usr/sbin/pkgadd`, `/usr/sbin/pkgrm`.
* Default for `os.family` == `solaris`.
* Supported features: `install_options`, `installable`, `uninstallable`, `upgradeable`.
#### sunfreeware {#package-provider-sunfreeware}
Package management using sunfreeware.com's `pkg-get` command on Solaris.
At this point, support is exactly the same as `blastwave` support and
has not actually been tested.
* Required binaries: `pkg-get`.
* Supported features: `installable`, `uninstallable`, `upgradeable`.
#### tdnf {#package-provider-tdnf}
Support via `tdnf`.
This provider supports the `install_options` attribute, which allows command-line flags to be passed to tdnf.
These options should be spcified as a string (e.g. '--flag'), a hash (e.g. {'--flag' => 'value'}), or an
array where each element is either a string or a hash.
* Required binaries: `rpm`, `tdnf`.
* Default for `os.name` == `PhotonOS`.
* Supported features: `install_options`, `installable`, `purgeable`, `uninstallable`, `upgradeable`, `versionable`, `virtual_packages`.
#### up2date {#package-provider-up2date}
Support for Red Hat's proprietary `up2date` package update
mechanism.
* Required binaries: `/usr/sbin/up2date-nox`.
* Default for `os.distro.release.full` == `2.1, 3, 4` and `os.family` == `redhat`.
* Supported features: `installable`, `uninstallable`, `upgradeable`.
#### urpmi {#package-provider-urpmi}
Support via `urpmi`.
* Required binaries: `rpm`, `urpme`, `urpmi`, `urpmq`.
* Default for `os.name` == `mandriva, mandrake`.
* Supported features: `installable`, `purgeable`, `uninstallable`, `upgradeable`, `versionable`.
#### windows {#package-provider-windows}
Windows package management.
This provider supports either MSI or self-extracting executable installers.
This provider requires a `source` attribute when installing the package.
It accepts paths to local files, mapped drives, or UNC paths.
This provider supports the `install_options` and `uninstall_options`
attributes, which allow command-line flags to be passed to the installer.
These options should be specified as an array where each element is either
a string or a hash.
If the executable requires special arguments to perform a silent install or
uninstall, then the appropriate arguments should be specified using the
`install_options` or `uninstall_options` attributes, respectively. Puppet
will automatically quote any option that contains spaces.
* Default for `os.name` == `windows`.
* Supported features: `install_options`, `installable`, `uninstall_options`, `uninstallable`, `versionable`.
#### xbps {#package-provider-xbps}
Support for the Package Manager Utility (xbps) used in VoidLinux.
This provider supports the `install_options` attribute, which allows command-line flags to be passed to xbps-install.
These options should be specified as an array where each element is either a string or a hash.
* Required binaries: `/usr/bin/xbps-install`, `/usr/bin/xbps-pkgdb`, `/usr/bin/xbps-query`, `/usr/bin/xbps-remove`.
* Default for `os.name` == `void`.
* Supported features: `holdable`, `install_options`, `installable`, `uninstall_options`, `uninstallable`, `upgradeable`, `virtual_packages`.
#### yum {#package-provider-yum}
Support via `yum`.
Using this provider's `uninstallable` feature will not remove dependent packages. To
remove dependent packages with this provider use the `purgeable` feature, but note this
feature is destructive and should be used with the utmost care.
This provider supports the `install_options` attribute, which allows command-line flags to be passed to yum.
These options should be specified as an array where each element is either a string or a hash.
* Required binaries: `rpm`, `yum`.
* Default for `os.name` == `amazon`. Default for `os.family` == `redhat` and `os.release.major` == `4, 5, 6, 7`.
* Supported features: `install_only`, `install_options`, `installable`, `purgeable`, `uninstallable`, `upgradeable`, `version_ranges`, `versionable`, `virtual_packages`.
#### zypper {#package-provider-zypper}
Support for SuSE `zypper` package manager. Found in SLES10sp2+ and SLES11.
This provider supports the `install_options` attribute, which allows command-line flags to be passed to zypper.
These options should be specified as an array where each element is either a
string or a hash.
* Required binaries: `/usr/bin/zypper`.
* Default for `os.name` == `suse, sles, sled, opensuse`.
* Supported features: `install_options`, `installable`, `uninstallable`, `upgradeable`, `versionable`, `virtual_packages`.
### Provider Features {#package-provider-features}
Available features:
* `disableable` --- The provider can disable packages. This feature is used by specifying `disabled` as the desired value for the package.
* `holdable` --- The provider is capable of placing packages on hold such that they are not automatically upgraded as a result of other package dependencies unless explicit action is taken by a user or another package.
* `install_only` --- The provider accepts options to only install packages never update (kernels, etc.)
* `install_options` --- The provider accepts options to be passed to the installer command.
* `installable` --- The provider can install packages.
* `package_settings` --- The provider accepts package_settings to be ensured for the given package. The meaning and format of these settings is provider-specific.
* `purgeable` --- The provider can purge packages. This generally means that all traces of the package are removed, including existing configuration files. This feature is thus destructive and should be used with the utmost care.
* `reinstallable` --- The provider can reinstall packages.
* `supports_flavors` --- The provider accepts flavors, which are specific variants of packages.
* `targetable` --- The provider accepts a targeted package management command.
* `uninstall_options` --- The provider accepts options to be passed to the uninstaller command.
* `uninstallable` --- The provider can uninstall packages.
* `upgradeable` --- The provider can upgrade to the latest version of a package. This feature is used by specifying `latest` as the desired value for the package.
* `version_ranges` --- The provider can ensure version ranges.
* `versionable` --- The provider is capable of interrogating the package database for installed version(s), and can select which out of a set of available versions of a package to install if asked.
* `virtual_packages` --- The provider accepts virtual package names for install and uninstall.
Provider support:
* **aix** - _installable, uninstallable, upgradeable, versionable_
* **appdmg** - _installable_
* **apple** - _installable_
* **apt** - _holdable, install options, installable, purgeable, uninstallable, upgradeable, version ranges, versionable, virtual packages_
* **aptitude** - _holdable, installable, purgeable, uninstallable, upgradeable, versionable_
* **aptrpm** - _installable, purgeable, uninstallable, upgradeable, versionable_
* **blastwave** - _installable, uninstallable, upgradeable_
* **dnf** - _install only, install options, installable, purgeable, uninstallable, upgradeable, version ranges, versionable, virtual packages_
* **dnfmodule** - _disableable, installable, purgeable, supports flavors, uninstallable, upgradeable, versionable_
* **dpkg** - _holdable, installable, purgeable, uninstallable, upgradeable, virtual packages_
* **fink** - _holdable, installable, purgeable, uninstallable, upgradeable, versionable_
* **freebsd** - _installable, purgeable, uninstallable, upgradeable_
* **gem** - _install options, installable, targetable, uninstall options, uninstallable, upgradeable, version ranges, versionable_
* **hpux** - _installable, uninstallable_
* **macports** - _installable, uninstallable, upgradeable, versionable_
* **nim** - _installable, uninstallable, upgradeable, versionable_
* **openbsd** - _install options, installable, purgeable, supports flavors, uninstall options, uninstallable, upgradeable, versionable_
* **opkg** - _installable, uninstallable, upgradeable_
* **pacman** - _install options, installable, purgeable, uninstall options, uninstallable, upgradeable, virtual packages_
* **pip** - _install options, installable, targetable, uninstallable, upgradeable, version ranges, versionable_
* **pip2** - _install options, installable, targetable, uninstallable, upgradeable, versionable_
* **pip3** - _install options, installable, targetable, uninstallable, upgradeable, versionable_
* **pkg** - _holdable, install options, installable, uninstallable, upgradeable, versionable_
* **pkgdmg** - _installable_
* **pkgin** - _installable, uninstallable, upgradeable, versionable_
* **pkgng** - _install options, installable, uninstallable, upgradeable, versionable_
* **pkgutil** - _installable, uninstallable, upgradeable_
* **portage** - _install options, installable, purgeable, reinstallable, uninstall options, uninstallable, upgradeable, versionable, virtual packages_
* **ports** - _installable, purgeable, uninstallable, upgradeable_
* **portupgrade** - _installable, uninstallable, upgradeable_
* **puppet_gem** - _install options, installable, uninstall options, uninstallable, upgradeable, versionable_
* **puppetserver_gem** - _install options, installable, uninstall options, uninstallable, upgradeable, versionable_
* **rpm** - _install only, install options, installable, uninstall options, uninstallable, upgradeable, versionable, virtual packages_
* **rug** - _installable, uninstallable, upgradeable, versionable_
* **sun** - _install options, installable, uninstallable, upgradeable_
* **sunfreeware** - _installable, uninstallable, upgradeable_
* **tdnf** - _install options, installable, purgeable, uninstallable, upgradeable, versionable, virtual packages_
* **up2date** - _installable, uninstallable, upgradeable_
* **urpmi** - _installable, purgeable, uninstallable, upgradeable, versionable_
* **windows** - _install options, installable, uninstall options, uninstallable, versionable_
* **xbps** - _holdable, install options, installable, uninstall options, uninstallable, upgradeable, virtual packages_
* **yum** - _install only, install options, installable, purgeable, uninstallable, upgradeable, version ranges, versionable, virtual packages_
* **zypper** - _install options, installable, uninstallable, upgradeable, versionable, virtual packages_
---------
## resources
* [Attributes](#resources-attributes)
### Description {#resources-description}
This is a metatype that can manage other resource types. Any
metaparams specified here will be passed on to any generated resources,
so you can purge unmanaged resources but set `noop` to true so the
purging is only logged and does not actually happen.
### Attributes {#resources-attributes}
<pre><code>resources { 'resource title':
<a href="#resources-attribute-name">name</a> => <em># <strong>(namevar)</strong> The name of the type to be...</em>
<a href="#resources-attribute-purge">purge</a> => <em># Whether to purge unmanaged resources. When set...</em>
<a href="#resources-attribute-unless_system_user">unless_system_user</a> => <em># This keeps system users from being purged. By...</em>
<a href="#resources-attribute-unless_uid">unless_uid</a> => <em># This keeps specific uids or ranges of uids from...</em>
# ...plus any applicable <a href="https://puppet.com/docs/puppet/latest/metaparameter.html">metaparameters</a>.
}</code></pre>
#### name {#resources-attribute-name}
_(**Namevar:** If omitted, this attribute's value defaults to the resource's title.)_
The name of the type to be managed.
([↑ Back to resources attributes](#resources-attributes))
#### purge {#resources-attribute-purge}
Whether to purge unmanaged resources. When set to `true`, this will
delete any resource that is not specified in your configuration and is not
autorequired by any managed resources. **Note:** The `ssh_authorized_key`
resource type can't be purged this way; instead, see the `purge_ssh_keys`
attribute of the `user` type.
Valid values are `true`, `false`, `yes`, `no`.
([↑ Back to resources attributes](#resources-attributes))
#### unless_system_user {#resources-attribute-unless_system_user}
This keeps system users from being purged. By default, it
does not purge users whose UIDs are less than the minimum UID for the system (typically 500 or 1000), but you can specify
a different UID as the inclusive limit.
Valid values are `true`, `false`. Values can match `/^\d+$/`.
([↑ Back to resources attributes](#resources-attributes))
#### unless_uid {#resources-attribute-unless_uid}
This keeps specific uids or ranges of uids from being purged when purge is true.
Accepts integers, integer strings, and arrays of integers or integer strings.
To specify a range of uids, consider using the range() function from stdlib.
([↑ Back to resources attributes](#resources-attributes))
---------
## schedule
* [Attributes](#schedule-attributes)
### Description {#schedule-description}
Define schedules for Puppet. Resources can be limited to a schedule by using the
[`schedule`](https://puppet.com/docs/puppet/latest/metaparameter.html#schedule)
metaparameter.
Currently, **schedules can only be used to stop a resource from being
applied;** they cannot cause a resource to be applied when it otherwise
wouldn't be, and they cannot accurately specify a time when a resource
should run.
Every time Puppet applies its configuration, it will apply the
set of resources whose schedule does not eliminate them from
running right then, but there is currently no system in place to
guarantee that a given resource runs at a given time. If you
specify a very restrictive schedule and Puppet happens to run at a
time within that schedule, then the resources will get applied;
otherwise, that work may never get done.
Thus, it is advisable to use wider scheduling (for example, over a couple
of hours) combined with periods and repetitions. For instance, if you
wanted to restrict certain resources to only running once, between
the hours of two and 4 AM, then you would use this schedule:
schedule { 'maint':
range => '2 - 4',
period => daily,
repeat => 1,
}
With this schedule, the first time that Puppet runs between 2 and 4 AM,
all resources with this schedule will get applied, but they won't
get applied again between 2 and 4 because they will have already
run once that day, and they won't get applied outside that schedule
because they will be outside the scheduled range.
Puppet automatically creates a schedule for each of the valid periods
with the same name as that period (such as hourly and daily).
Additionally, a schedule named `puppet` is created and used as the
default, with the following attributes:
schedule { 'puppet':
period => hourly,
repeat => 2,
}
This will cause resources to be applied every 30 minutes by default.
The `statettl` setting on the agent affects the ability of a schedule to
determine if a resource has already been checked. If the `statettl` is
set lower than the span of the associated schedule resource, then a
resource could be checked & applied multiple times in the schedule as
the information about when the resource was last checked will have
expired from the cache.
### Attributes {#schedule-attributes}
<pre><code>schedule { 'resource title':
<a href="#schedule-attribute-name">name</a> => <em># <strong>(namevar)</strong> The name of the schedule. This name is used...</em>
<a href="#schedule-attribute-period">period</a> => <em># The period of repetition for resources on this...</em>
<a href="#schedule-attribute-periodmatch">periodmatch</a> => <em># Whether periods should be matched by a numeric...</em>
<a href="#schedule-attribute-range">range</a> => <em># The earliest and latest that a resource can be...</em>
<a href="#schedule-attribute-repeat">repeat</a> => <em># How often a given resource may be applied in...</em>
<a href="#schedule-attribute-weekday">weekday</a> => <em># The days of the week in which the schedule...</em>
# ...plus any applicable <a href="https://puppet.com/docs/puppet/latest/metaparameter.html">metaparameters</a>.
}</code></pre>
#### name {#schedule-attribute-name}
_(**Namevar:** If omitted, this attribute's value defaults to the resource's title.)_
The name of the schedule. This name is used when assigning the schedule
to a resource with the `schedule` metaparameter:
schedule { 'everyday':
period => daily,
range => '2 - 4',
}
exec { '/usr/bin/apt-get update':
schedule => 'everyday',
}
([↑ Back to schedule attributes](#schedule-attributes))
#### period {#schedule-attribute-period}
The period of repetition for resources on this schedule. The default is
for resources to get applied every time Puppet runs.
Note that the period defines how often a given resource will get
applied but not when; if you would like to restrict the hours
that a given resource can be applied (for instance, only at night
during a maintenance window), then use the `range` attribute.
If the provided periods are not sufficient, you can provide a
value to the *repeat* attribute, which will cause Puppet to
schedule the affected resources evenly in the period the
specified number of times. Take this schedule:
schedule { 'veryoften':
period => hourly,
repeat => 6,
}
This can cause Puppet to apply that resource up to every 10 minutes.
At the moment, Puppet cannot guarantee that level of repetition; that
is, the resource can applied _up to_ every 10 minutes, but internal
factors might prevent it from actually running that often (for instance,
if a Puppet run is still in progress when the next run is scheduled to
start, that next run will be suppressed).
See the `periodmatch` attribute for tuning whether to match
times by their distance apart or by their specific value.
> **Tip**: You can use `period => never,` to prevent a resource from being applied
in the given `range`. This is useful if you need to create a blackout window to
perform sensitive operations without interruption.
Valid values are `hourly`, `daily`, `weekly`, `monthly`, `never`.
([↑ Back to schedule attributes](#schedule-attributes))
#### periodmatch {#schedule-attribute-periodmatch}
Whether periods should be matched by a numeric value (for instance,
whether two times are in the same hour) or by their chronological
distance apart (whether two times are 60 minutes apart).
Valid values are `number`, `distance`.
([↑ Back to schedule attributes](#schedule-attributes))
#### range {#schedule-attribute-range}
The earliest and latest that a resource can be applied. This is
always a hyphen-separated range within a 24 hour period, and hours
must be specified in numbers between 0 and 23, inclusive. Minutes and
seconds can optionally be provided, using the normal colon as a
separator. For instance:
schedule { 'maintenance':
range => '1:30 - 4:30',
}
This is mostly useful for restricting certain resources to being
applied in maintenance windows or during off-peak hours. Multiple
ranges can be applied in array context. As a convenience when specifying
ranges, you can cross midnight (for example, `range => "22:00 - 04:00"`).
([↑ Back to schedule attributes](#schedule-attributes))
#### repeat {#schedule-attribute-repeat}
How often a given resource may be applied in this schedule's `period`.
Must be an integer.
([↑ Back to schedule attributes](#schedule-attributes))
#### weekday {#schedule-attribute-weekday}
The days of the week in which the schedule should be valid.
You may specify the full day name 'Tuesday', the three character
abbreviation 'Tue', or a number (as a string or as an integer) corresponding to the day of the
week where 0 is Sunday, 1 is Monday, and so on. Multiple days can be specified
as an array. If not specified, the day of the week will not be
considered in the schedule.
If you are also using a range match that spans across midnight
then this parameter will match the day that it was at the start
of the range, not necessarily the day that it is when it matches.
For example, consider this schedule:
schedule { 'maintenance_window':
range => '22:00 - 04:00',
weekday => 'Saturday',
}
This will match at 11 PM on Saturday and 2 AM on Sunday, but not
at 2 AM on Saturday.
([↑ Back to schedule attributes](#schedule-attributes))
---------
## service
* [Attributes](#service-attributes)
* [Providers](#service-providers)
* [Provider Features](#service-provider-features)
### Description {#service-description}
Manage running services. Service support unfortunately varies
widely by platform --- some platforms have very little if any concept of a
running service, and some have a very codified and powerful concept.
Puppet's service support is usually capable of doing the right thing, but
the more information you can provide, the better behaviour you will get.
Puppet 2.7 and newer expect init scripts to have a working status command.
If this isn't the case for any of your services' init scripts, you will
need to set `hasstatus` to false and possibly specify a custom status
command in the `status` attribute. As a last resort, Puppet will attempt to
search the process table by calling whatever command is listed in the `ps`
fact. The default search pattern is the name of the service, but you can
specify it with the `pattern` attribute.
**Refresh:** `service` resources can respond to refresh events (via
`notify`, `subscribe`, or the `~>` arrow). If a `service` receives an
event from another resource, Puppet will restart the service it manages.
The actual command used to restart the service depends on the platform and
can be configured:
* If you set `hasrestart` to true, Puppet will use the init script's restart command.
* You can provide an explicit command for restarting with the `restart` attribute.
* If you do neither, the service's stop and start commands will be used.
### Attributes {#service-attributes}
<pre><code>service { 'resource title':
<a href="#service-attribute-name">name</a> => <em># <strong>(namevar)</strong> The name of the service to run. This name is...</em>
<a href="#service-attribute-ensure">ensure</a> => <em># Whether a service should be running. Default...</em>
<a href="#service-attribute-binary">binary</a> => <em># The path to the daemon. This is only used for...</em>
<a href="#service-attribute-control">control</a> => <em># The control variable used to manage services...</em>
<a href="#service-attribute-enable">enable</a> => <em># Whether a service should be enabled to start at...</em>
<a href="#service-attribute-flags">flags</a> => <em># Specify a string of flags to pass to the startup </em>
<a href="#service-attribute-hasrestart">hasrestart</a> => <em># Specify that an init script has a `restart...</em>
<a href="#service-attribute-hasstatus">hasstatus</a> => <em># Declare whether the service's init script has a...</em>
<a href="#service-attribute-logonaccount">logonaccount</a> => <em># Specify an account for service logon Requires </em>
<a href="#service-attribute-logonpassword">logonpassword</a> => <em># Specify a password for service logon. Default...</em>
<a href="#service-attribute-manifest">manifest</a> => <em># Specify a command to config a service, or a path </em>
<a href="#service-attribute-path">path</a> => <em># The search path for finding init scripts....</em>
<a href="#service-attribute-pattern">pattern</a> => <em># The pattern to search for in the process table...</em>
<a href="#service-attribute-provider">provider</a> => <em># The specific backend to use for this `service...</em>
<a href="#service-attribute-restart">restart</a> => <em># Specify a *restart* command manually. If left...</em>
<a href="#service-attribute-start">start</a> => <em># Specify a *start* command manually. Most...</em>
<a href="#service-attribute-status">status</a> => <em># Specify a *status* command manually. This...</em>
<a href="#service-attribute-stop">stop</a> => <em># Specify a *stop* command...</em>
<a href="#service-attribute-timeout">timeout</a> => <em># Specify an optional minimum timeout (in seconds) </em>
# ...plus any applicable <a href="https://puppet.com/docs/puppet/latest/metaparameter.html">metaparameters</a>.
}</code></pre>
#### name {#service-attribute-name}
_(**Namevar:** If omitted, this attribute's value defaults to the resource's title.)_
The name of the service to run.
This name is used to find the service; on platforms where services
have short system names and long display names, this should be the
short name. (To take an example from Windows, you would use "wuauserv"
rather than "Automatic Updates.")
([↑ Back to service attributes](#service-attributes))
#### ensure {#service-attribute-ensure}
_(**Property:** This attribute represents concrete state on the target system.)_
Whether a service should be running. Default values depend on the platform.
Valid values are `stopped` (also called `false`), `running` (also called `true`).
([↑ Back to service attributes](#service-attributes))
#### binary {#service-attribute-binary}
The path to the daemon. This is only used for
systems that do not support init scripts. This binary will be
used to start the service if no `start` parameter is
provided.
([↑ Back to service attributes](#service-attributes))
#### control {#service-attribute-control}
The control variable used to manage services (originally for HP-UX).
Defaults to the upcased service name plus `START` replacing dots with
underscores, for those providers that support the `controllable` feature.
([↑ Back to service attributes](#service-attributes))
#### enable {#service-attribute-enable}
_(**Property:** This attribute represents concrete state on the target system.)_
Whether a service should be enabled to start at boot.
This property behaves differently depending on the platform;
wherever possible, it relies on local tools to enable or disable
a given service. Default values depend on the platform.
If you don't specify a value for the `enable` attribute, Puppet leaves
that aspect of the service alone and your operating system determines
the behavior.
Valid values are `true`, `false`, `manual`, `mask`, `delayed`.
Requires features enableable.
([↑ Back to service attributes](#service-attributes))
#### flags {#service-attribute-flags}
_(**Property:** This attribute represents concrete state on the target system.)_
Specify a string of flags to pass to the startup script.
Requires features flaggable.
([↑ Back to service attributes](#service-attributes))
#### hasrestart {#service-attribute-hasrestart}
Specify that an init script has a `restart` command. If this is
false and you do not specify a command in the `restart` attribute,
the init script's `stop` and `start` commands will be used.
Valid values are `true`, `false`.
([↑ Back to service attributes](#service-attributes))
#### hasstatus {#service-attribute-hasstatus}
Declare whether the service's init script has a functional status
command. This attribute's default value changed in Puppet 2.7.0.
The init script's status command must return 0 if the service is
running and a nonzero value otherwise. Ideally, these exit codes
should conform to [the LSB's specification][lsb-exit-codes] for init
script status actions, but Puppet only considers the difference
between 0 and nonzero to be relevant.
If a service's init script does not support any kind of status command,
you should set `hasstatus` to false and either provide a specific
command using the `status` attribute or expect that Puppet will look for
the service name in the process table. Be aware that 'virtual' init
scripts (like 'network' under Red Hat systems) will respond poorly to
refresh events from other resources if you override the default behavior
without providing a status command.
Valid values are `true`, `false`.
([↑ Back to service attributes](#service-attributes))
#### logonaccount {#service-attribute-logonaccount}
_(**Property:** This attribute represents concrete state on the target system.)_
Specify an account for service logon
Requires features manages_logon_credentials.
([↑ Back to service attributes](#service-attributes))
#### logonpassword {#service-attribute-logonpassword}
Specify a password for service logon. Default value is an empty string (when logonaccount is specified).
Requires features manages_logon_credentials.
([↑ Back to service attributes](#service-attributes))
#### manifest {#service-attribute-manifest}
Specify a command to config a service, or a path to a manifest to do so.
([↑ Back to service attributes](#service-attributes))
#### path {#service-attribute-path}
The search path for finding init scripts. Multiple values should
be separated by colons or provided as an array.
([↑ Back to service attributes](#service-attributes))
#### pattern {#service-attribute-pattern}
The pattern to search for in the process table.
This is used for stopping services on platforms that do not
support init scripts, and is also used for determining service
status on those service whose init scripts do not include a status
command.
Defaults to the name of the service. The pattern can be a simple string
or any legal Ruby pattern, including regular expressions (which should
be quoted without enclosing slashes).
([↑ Back to service attributes](#service-attributes))
#### provider {#service-attribute-provider}
The specific backend to use for this `service`
resource. You will seldom need to specify this --- Puppet will usually
discover the appropriate provider for your platform.
Available providers are:
* [`base`](#service-provider-base)
* [`bsd`](#service-provider-bsd)
* [`daemontools`](#service-provider-daemontools)
* [`debian`](#service-provider-debian)
* [`freebsd`](#service-provider-freebsd)
* [`gentoo`](#service-provider-gentoo)
* [`init`](#service-provider-init)
* [`launchd`](#service-provider-launchd)
* [`openbsd`](#service-provider-openbsd)
* [`openrc`](#service-provider-openrc)
* [`openwrt`](#service-provider-openwrt)
* [`rcng`](#service-provider-rcng)
* [`redhat`](#service-provider-redhat)
* [`runit`](#service-provider-runit)
* [`service`](#service-provider-service)
* [`smf`](#service-provider-smf)
* [`src`](#service-provider-src)
* [`systemd`](#service-provider-systemd)
* [`upstart`](#service-provider-upstart)
* [`windows`](#service-provider-windows)
([↑ Back to service attributes](#service-attributes))
#### restart {#service-attribute-restart}
Specify a *restart* command manually. If left
unspecified, the service will be stopped and then started.
([↑ Back to service attributes](#service-attributes))
#### start {#service-attribute-start}
Specify a *start* command manually. Most service subsystems
support a `start` command, so this will not need to be
specified.
([↑ Back to service attributes](#service-attributes))
#### status {#service-attribute-status}
Specify a *status* command manually. This command must
return 0 if the service is running and a nonzero value otherwise.
Ideally, these exit codes should conform to [the LSB's
specification][lsb-exit-codes] for init script status actions, but
Puppet only considers the difference between 0 and nonzero to be
relevant.
If left unspecified, the status of the service will be determined
automatically, usually by looking for the service in the process
table.
[lsb-exit-codes]: http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
([↑ Back to service attributes](#service-attributes))
#### stop {#service-attribute-stop}
Specify a *stop* command manually.
([↑ Back to service attributes](#service-attributes))
#### timeout {#service-attribute-timeout}
Specify an optional minimum timeout (in seconds) for puppet to wait when syncing service properties
Requires features configurable_timeout.
([↑ Back to service attributes](#service-attributes))
### Providers {#service-providers}
#### base {#service-provider-base}
The simplest form of Unix service support.
You have to specify enough about your service for this to work; the
minimum you can specify is a binary for starting the process, and this
same binary will be searched for in the process table to stop the
service. As with `init`-style services, it is preferable to specify start,
stop, and status commands.
* Required binaries: `kill`.
* Supported features: `refreshable`.
#### bsd {#service-provider-bsd}
Generic BSD form of `init`-style service management with `rc.d`.
Uses `rc.conf.d` for service enabling and disabling.
* Supported features: `enableable`, `refreshable`.
#### daemontools {#service-provider-daemontools}
Daemontools service management.
This provider manages daemons supervised by D.J. Bernstein daemontools.
When detecting the service directory it will check, in order of preference:
* `/service`
* `/etc/service`
* `/var/lib/svscan`
The daemon directory should be in one of the following locations:
* `/var/lib/service`
* `/etc`
...or this can be overridden in the resource's attributes:
service { 'myservice':
provider => 'daemontools',
path => '/path/to/daemons',
}
This provider supports out of the box:
* start/stop (mapped to enable/disable)
* enable/disable
* restart
* status
If a service has `ensure => "running"`, it will link /path/to/daemon to
/path/to/service, which will automatically enable the service.
If a service has `ensure => "stopped"`, it will only shut down the service, not
remove the `/path/to/service` link.
* Required binaries: `/usr/bin/svc`, `/usr/bin/svstat`.
* Supported features: `enableable`, `refreshable`.
#### debian {#service-provider-debian}
Debian's form of `init`-style management.
The only differences from `init` are support for enabling and disabling
services via `update-rc.d` and the ability to determine enabled status via
`invoke-rc.d`.
* Required binaries: `/usr/sbin/invoke-rc.d`, `/usr/sbin/service`, `/usr/sbin/update-rc.d`.
* Default for `os.name` == `cumuluslinux` and `os.release.major` == `1, 2`. Default for `os.name` == `debian` and `os.release.major` == `5, 6, 7`. Default for `os.name` == `devuan`.
* Supported features: `enableable`, `refreshable`.
#### freebsd {#service-provider-freebsd}
Provider for FreeBSD and DragonFly BSD. Uses the `rcvar` argument of init scripts and parses/edits rc files.
* Default for `os.name` == `freebsd, dragonfly`.
* Supported features: `enableable`, `refreshable`.
#### gentoo {#service-provider-gentoo}
Gentoo's form of `init`-style service management.
Uses `rc-update` for service enabling and disabling.
* Required binaries: `/sbin/rc-update`.
* Supported features: `enableable`, `refreshable`.
#### init {#service-provider-init}
Standard `init`-style service management.
* Supported features: `refreshable`.
#### launchd {#service-provider-launchd}
This provider manages jobs with `launchd`, which is the default service
framework for Mac OS X (and may be available for use on other platforms).
For more information, see the `launchd` man page:
* <https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man8/launchd.8.html>
This provider reads plists out of the following directories:
* `/System/Library/LaunchDaemons`
* `/System/Library/LaunchAgents`
* `/Library/LaunchDaemons`
* `/Library/LaunchAgents`
...and builds up a list of services based upon each plist's "Label" entry.
This provider supports:
* ensure => running/stopped,
* enable => true/false
* status
* restart
Here is how the Puppet states correspond to `launchd` states:
* stopped --- job unloaded
* started --- job loaded
* enabled --- 'Disable' removed from job plist file
* disabled --- 'Disable' added to job plist file
Note that this allows you to do something `launchctl` can't do, which is to
be in a state of "stopped/enabled" or "running/disabled".
Note that this provider does not support overriding 'restart'
* Required binaries: `/bin/launchctl`.
* Default for `os.name` == `darwin`.
* Supported features: `enableable`, `refreshable`.
#### openbsd {#service-provider-openbsd}
Provider for OpenBSD's rc.d daemon control scripts
* Required binaries: `/usr/sbin/rcctl`.
* Default for `os.name` == `openbsd`.
* Supported features: `enableable`, `flaggable`, `refreshable`.
#### openrc {#service-provider-openrc}
Support for Gentoo's OpenRC initskripts
Uses rc-update, rc-status and rc-service to manage services.
* Required binaries: `/bin/rc-status`, `/sbin/rc-service`, `/sbin/rc-update`.
* Default for `os.name` == `gentoo`. Default for `os.name` == `funtoo`.
* Supported features: `enableable`, `refreshable`.
#### openwrt {#service-provider-openwrt}
Support for OpenWrt flavored init scripts.
Uses /etc/init.d/service_name enable, disable, and enabled.
* Default for `os.name` == `openwrt`.
* Supported features: `enableable`, `refreshable`.
#### rcng {#service-provider-rcng}
RCng service management with rc.d
* Default for `os.name` == `netbsd, cargos`.
* Supported features: `enableable`, `refreshable`.
#### redhat {#service-provider-redhat}
Red Hat's (and probably many others') form of `init`-style service
management. Uses `chkconfig` for service enabling and disabling.
* Required binaries: `/sbin/chkconfig`, `/sbin/service`.
* Default for `os.name` == `amazon` and `os.release.major` == `2017, 2018`. Default for `os.name` == `redhat` and `os.release.major` == `4, 5, 6`. Default for `os.family` == `suse` and `os.release.major` == `10, 11`.
* Supported features: `enableable`, `refreshable`.
#### runit {#service-provider-runit}
Runit service management.
This provider manages daemons running supervised by Runit.
When detecting the service directory it will check, in order of preference:
* `/service`
* `/etc/service`
* `/var/service`
The daemon directory should be in one of the following locations:
* `/etc/sv`
* `/var/lib/service`
or this can be overridden in the service resource parameters:
service { 'myservice':
provider => 'runit',
path => '/path/to/daemons',
}
This provider supports out of the box:
* start/stop
* enable/disable
* restart
* status
* Required binaries: `/usr/bin/sv`.
* Supported features: `enableable`, `refreshable`.
#### service {#service-provider-service}
The simplest form of service support.
* Supported features: `refreshable`.
#### smf {#service-provider-smf}
Support for Sun's new Service Management Framework.
When managing the enable property, this provider will try to preserve
the previous ensure state per the enableable semantics. On Solaris,
enabling a service starts it up while disabling a service stops it. Thus,
there's a chance for this provider to execute two operations when managing
the enable property. For example, if enable is set to true and the ensure
state is stopped, this provider will manage the service using two operations:
one to enable the service which will start it up, and another to stop the
service (without affecting its enabled status).
By specifying `manifest => "/path/to/service.xml"`, the SMF manifest will
be imported if it does not exist.
* Required binaries: `/usr/bin/svcs`, `/usr/sbin/svcadm`, `/usr/sbin/svccfg`.
* Default for `os.family` == `solaris`.
* Supported features: `enableable`, `refreshable`.
#### src {#service-provider-src}
Support for AIX's System Resource controller.
Services are started/stopped based on the `stopsrc` and `startsrc`
commands, and some services can be refreshed with `refresh` command.
Enabling and disabling services is not supported, as it requires
modifications to `/etc/inittab`. Starting and stopping groups of subsystems
is not yet supported.
* Required binaries: `/usr/bin/lssrc`, `/usr/bin/refresh`, `/usr/bin/startsrc`, `/usr/bin/stopsrc`, `/usr/sbin/chitab`, `/usr/sbin/lsitab`, `/usr/sbin/mkitab`, `/usr/sbin/rmitab`.
* Default for `os.name` == `aix`.
* Supported features: `enableable`, `refreshable`.
#### systemd {#service-provider-systemd}
Manages `systemd` services using `systemctl`.
Because `systemd` defaults to assuming the `.service` unit type, the suffix
may be omitted. Other unit types (such as `.path`) may be managed by
providing the proper suffix.
* Required binaries: `systemctl`.
* Default for `os.family` == `archlinux`. Default for `os.family` == `redhat`. Default for `os.family` == `redhat` and `os.name` == `fedora`. Default for `os.family` == `suse`. Default for `os.family` == `coreos`. Default for `os.family` == `gentoo`. Default for `os.name` == `amazon` and `os.release.major` == `2, 2023`. Default for `os.name` == `debian`. Default for `os.name` == `LinuxMint`. Default for `os.name` == `ubuntu`. Default for `os.name` == `cumuluslinux` and `os.release.major` == `3, 4`. Default for `os.name` == `raspbian` and `os.release.major` == `12`.
* Supported features: `enableable`, `maskable`, `refreshable`.
#### upstart {#service-provider-upstart}
Ubuntu service management with `upstart`.
This provider manages `upstart` jobs on Ubuntu. For `upstart` documentation,
see <http://upstart.ubuntu.com/>.
* Required binaries: `/sbin/initctl`, `/sbin/restart`, `/sbin/start`, `/sbin/status`, `/sbin/stop`.
* Default for `os.name` == `ubuntu` and `os.release.major` == `10.04, 12.04, 14.04, 14.10`. Default for `os.name` == `LinuxMint` and `os.release.major` == `10, 11, 12, 13, 14, 15, 16, 17`.
* Supported features: `enableable`, `refreshable`.
#### windows {#service-provider-windows}
Support for Windows Service Control Manager (SCM). This provider can
start, stop, enable, and disable services, and the SCM provides working
status methods for all services.
Control of service groups (dependencies) is not yet supported, nor is running
services as a specific user.
* Default for `os.name` == `windows`.
* Supported features: `configurable_timeout`, `delayed_startable`, `enableable`, `manages_logon_credentials`, `manual_startable`, `refreshable`.
### Provider Features {#service-provider-features}
Available features:
* `configurable_timeout` --- The provider can specify a minumum timeout for syncing service properties
* `controllable` --- The provider uses a control variable.
* `delayed_startable` --- The provider can set service to delayed start
* `enableable` --- The provider can enable and disable the service.
* `flaggable` --- The provider can pass flags to the service.
* `manages_logon_credentials` --- The provider can specify the logon credentials used for a service
* `manual_startable` --- The provider can set service to manual start
* `maskable` --- The provider can 'mask' the service.
* `refreshable` --- The provider can restart the service.
Provider support:
* **base** - _refreshable_
* **bsd** - _enableable, refreshable_
* **daemontools** - _enableable, refreshable_
* **debian** - _enableable, refreshable_
* **freebsd** - _enableable, refreshable_
* **gentoo** - _enableable, refreshable_
* **init** - _refreshable_
* **launchd** - _enableable, refreshable_
* **openbsd** - _enableable, flaggable, refreshable_
* **openrc** - _enableable, refreshable_
* **openwrt** - _enableable, refreshable_
* **rcng** - _enableable, refreshable_
* **redhat** - _enableable, refreshable_
* **runit** - _enableable, refreshable_
* **service** - _refreshable_
* **smf** - _enableable, refreshable_
* **src** - _enableable, refreshable_
* **systemd** - _enableable, maskable, refreshable_
* **upstart** - _enableable, refreshable_
* **windows** - _configurable timeout, delayed startable, enableable, manages logon credentials, manual startable, refreshable_
---------
## stage
* [Attributes](#stage-attributes)
### Description {#stage-description}
A resource type for creating new run stages. Once a stage is available,
classes can be assigned to it by declaring them with the resource-like syntax
and using
[the `stage` metaparameter](https://puppet.com/docs/puppet/latest/metaparameter.html#stage).
Note that new stages are not useful unless you also declare their order
in relation to the default `main` stage.
A complete run stage example:
stage { 'pre':
before => Stage['main'],
}
class { 'apt-updates':
stage => 'pre',
}
Individual resources cannot be assigned to run stages; you can only set stages
for classes.
### Attributes {#stage-attributes}
<pre><code>stage { 'resource title':
<a href="#stage-attribute-name">name</a> => <em># <strong>(namevar)</strong> The name of the stage. Use this as the value for </em>
# ...plus any applicable <a href="https://puppet.com/docs/puppet/latest/metaparameter.html">metaparameters</a>.
}</code></pre>
#### name {#stage-attribute-name}
_(**Namevar:** If omitted, this attribute's value defaults to the resource's title.)_
The name of the stage. Use this as the value for the `stage` metaparameter
when assigning classes to this stage.
([↑ Back to stage attributes](#stage-attributes))
---------
## tidy
* [Attributes](#tidy-attributes)
### Description {#tidy-description}
Remove unwanted files based on specific criteria. Multiple
criteria are OR'd together, so a file that is too large but is not
old enough will still get tidied. Ignores managed resources.
If you don't specify either `age` or `size`, then all files will
be removed.
This resource type works by generating a file resource for every file
that should be deleted and then letting that resource perform the
actual deletion.
### Attributes {#tidy-attributes}
<pre><code>tidy { 'resource title':
<a href="#tidy-attribute-path">path</a> => <em># <strong>(namevar)</strong> The path to the file or directory to manage....</em>
<a href="#tidy-attribute-age">age</a> => <em># Tidy files whose age is equal to or greater than </em>
<a href="#tidy-attribute-backup">backup</a> => <em># Whether tidied files should be backed up. Any...</em>
<a href="#tidy-attribute-matches">matches</a> => <em># One or more (shell type) file glob patterns...</em>
<a href="#tidy-attribute-max_files">max_files</a> => <em># In case the resource is a directory and the...</em>
<a href="#tidy-attribute-recurse">recurse</a> => <em># If target is a directory, recursively descend...</em>
<a href="#tidy-attribute-rmdirs">rmdirs</a> => <em># Tidy directories in addition to files; that is...</em>
<a href="#tidy-attribute-size">size</a> => <em># Tidy files whose size is equal to or greater...</em>
<a href="#tidy-attribute-type">type</a> => <em># Set the mechanism for determining age. Valid...</em>
# ...plus any applicable <a href="https://puppet.com/docs/puppet/latest/metaparameter.html">metaparameters</a>.
}</code></pre>
#### path {#tidy-attribute-path}
_(**Namevar:** If omitted, this attribute's value defaults to the resource's title.)_
The path to the file or directory to manage. Must be fully
qualified.
([↑ Back to tidy attributes](#tidy-attributes))
#### age {#tidy-attribute-age}
Tidy files whose age is equal to or greater than
the specified time. You can choose seconds, minutes,
hours, days, or weeks by specifying the first letter of any
of those words (for example, '1w' represents one week).
Specifying 0 will remove all files.
([↑ Back to tidy attributes](#tidy-attributes))
#### backup {#tidy-attribute-backup}
Whether tidied files should be backed up. Any values are passed
directly to the file resources used for actual file deletion, so consult
the `file` type's backup documentation to determine valid values.
([↑ Back to tidy attributes](#tidy-attributes))
#### matches {#tidy-attribute-matches}
One or more (shell type) file glob patterns, which restrict
the list of files to be tidied to those whose basenames match
at least one of the patterns specified. Multiple patterns can
be specified using an array.
Example:
tidy { '/tmp':
age => '1w',
recurse => 1,
matches => [ '[0-9]pub*.tmp', '*.temp', 'tmpfile?' ],
}
This removes files from `/tmp` if they are one week old or older,
are not in a subdirectory and match one of the shell globs given.
Note that the patterns are matched against the basename of each
file -- that is, your glob patterns should not have any '/'
characters in them, since you are only specifying against the last
bit of the file.
Finally, note that you must now specify a non-zero/non-false value
for recurse if matches is used, as matches only apply to files found
by recursion (there's no reason to use static patterns match against
a statically determined path). Requiring explicit recursion clears
up a common source of confusion.
([↑ Back to tidy attributes](#tidy-attributes))
#### max_files {#tidy-attribute-max_files}
In case the resource is a directory and the recursion is enabled, puppet will
generate a new resource for each file file found, possible leading to
an excessive number of resources generated without any control.
Setting `max_files` will check the number of file resources that
will eventually be created and will raise a resource argument error if the
limit will be exceeded.
Use value `0` to disable the check. In this case, a warning is logged if
the number of files exceeds 1000.
Values can match `/^[0-9]+$/`.
([↑ Back to tidy attributes](#tidy-attributes))
#### recurse {#tidy-attribute-recurse}
If target is a directory, recursively descend
into the directory looking for files to tidy.
Valid values are `true`, `false`, `inf`. Values can match `/^[0-9]+$/`.
([↑ Back to tidy attributes](#tidy-attributes))
#### rmdirs {#tidy-attribute-rmdirs}
Tidy directories in addition to files; that is, remove
directories whose age is older than the specified criteria.
This will only remove empty directories, so all contained
files must also be tidied before a directory gets removed.
Valid values are `true`, `false`, `yes`, `no`.
([↑ Back to tidy attributes](#tidy-attributes))
#### size {#tidy-attribute-size}
Tidy files whose size is equal to or greater than
the specified size. Unqualified values are in kilobytes, but
*b*, *k*, *m*, *g*, and *t* can be appended to specify *bytes*,
*kilobytes*, *megabytes*, *gigabytes*, and *terabytes*, respectively.
Only the first character is significant, so the full word can also
be used.
([↑ Back to tidy attributes](#tidy-attributes))
#### type {#tidy-attribute-type}
Set the mechanism for determining age.
Valid values are `atime`, `mtime`, `ctime`.
([↑ Back to tidy attributes](#tidy-attributes))
---------
## user
* [Attributes](#user-attributes)
* [Providers](#user-providers)
* [Provider Features](#user-provider-features)
### Description {#user-description}
Manage users. This type is mostly built to manage system
users, so it is lacking some features useful for managing normal
users.
This resource type uses the prescribed native tools for creating
groups and generally uses POSIX APIs for retrieving information
about them. It does not directly modify `/etc/passwd` or anything.
**Autorequires:** If Puppet is managing the user's primary group (as
provided in the `gid` attribute) or any group listed in the `groups`
attribute then the user resource will autorequire that group. If Puppet
is managing any role accounts corresponding to the user's roles, the
user resource will autorequire those role accounts.
### Attributes {#user-attributes}
<pre><code>user { 'resource title':
<a href="#user-attribute-name">name</a> => <em># <strong>(namevar)</strong> The user name. While naming limitations vary by...</em>
<a href="#user-attribute-ensure">ensure</a> => <em># The basic state that the object should be in....</em>
<a href="#user-attribute-allowdupe">allowdupe</a> => <em># Whether to allow duplicate UIDs. Valid values...</em>
<a href="#user-attribute-attribute_membership">attribute_membership</a> => <em># Whether specified attribute value pairs should...</em>
<a href="#user-attribute-attributes">attributes</a> => <em># Specify AIX attributes for the user in an array...</em>
<a href="#user-attribute-auth_membership">auth_membership</a> => <em># Whether specified auths should be considered the </em>
<a href="#user-attribute-auths">auths</a> => <em># The auths the user has. Multiple auths should...</em>
<a href="#user-attribute-comment">comment</a> => <em># A description of the user. Generally the user's </em>
<a href="#user-attribute-expiry">expiry</a> => <em># The expiry date for this user. Provide as either </em>
<a href="#user-attribute-forcelocal">forcelocal</a> => <em># Forces the management of local accounts when...</em>
<a href="#user-attribute-gid">gid</a> => <em># The user's primary group. Can be specified...</em>
<a href="#user-attribute-groups">groups</a> => <em># The groups to which the user belongs. The...</em>
<a href="#user-attribute-home">home</a> => <em># The home directory of the user. The directory...</em>
<a href="#user-attribute-ia_load_module">ia_load_module</a> => <em># The name of the I&A module to use to manage this </em>
<a href="#user-attribute-iterations">iterations</a> => <em># This is the number of iterations of a chained...</em>
<a href="#user-attribute-key_membership">key_membership</a> => <em># Whether specified key/value pairs should be...</em>
<a href="#user-attribute-keys">keys</a> => <em># Specify user attributes in an array of key ...</em>
<a href="#user-attribute-loginclass">loginclass</a> => <em># The name of login class to which the user...</em>
<a href="#user-attribute-managehome">managehome</a> => <em># Whether to manage the home directory when Puppet </em>
<a href="#user-attribute-membership">membership</a> => <em># If `minimum` is specified, Puppet will ensure...</em>
<a href="#user-attribute-password">password</a> => <em># The user's password, in whatever encrypted...</em>
<a href="#user-attribute-password_max_age">password_max_age</a> => <em># The maximum number of days a password may be...</em>
<a href="#user-attribute-password_min_age">password_min_age</a> => <em># The minimum number of days a password must be...</em>
<a href="#user-attribute-password_warn_days">password_warn_days</a> => <em># The number of days before a password is going to </em>
<a href="#user-attribute-profile_membership">profile_membership</a> => <em># Whether specified roles should be treated as the </em>
<a href="#user-attribute-profiles">profiles</a> => <em># The profiles the user has. Multiple profiles...</em>
<a href="#user-attribute-project">project</a> => <em># The name of the project associated with a user. </em>
<a href="#user-attribute-provider">provider</a> => <em># The specific backend to use for this `user...</em>
<a href="#user-attribute-purge_ssh_keys">purge_ssh_keys</a> => <em># Whether to purge authorized SSH keys for this...</em>
<a href="#user-attribute-role_membership">role_membership</a> => <em># Whether specified roles should be considered the </em>
<a href="#user-attribute-roles">roles</a> => <em># The roles the user has. Multiple roles should...</em>
<a href="#user-attribute-salt">salt</a> => <em># This is the 32-byte salt used to generate the...</em>
<a href="#user-attribute-shell">shell</a> => <em># The user's login shell. The shell must exist...</em>
<a href="#user-attribute-system">system</a> => <em># Whether the user is a system user, according to...</em>
<a href="#user-attribute-uid">uid</a> => <em># The user ID; must be specified numerically. If...</em>
# ...plus any applicable <a href="https://puppet.com/docs/puppet/latest/metaparameter.html">metaparameters</a>.
}</code></pre>
#### name {#user-attribute-name}
_(**Namevar:** If omitted, this attribute's value defaults to the resource's title.)_
The user name. While naming limitations vary by operating system,
it is advisable to restrict names to the lowest common denominator,
which is a maximum of 8 characters beginning with a letter.
Note that Puppet considers user names to be case-sensitive, regardless
of the platform's own rules; be sure to always use the same case when
referring to a given user.
([↑ Back to user attributes](#user-attributes))
#### ensure {#user-attribute-ensure}
_(**Property:** This attribute represents concrete state on the target system.)_
The basic state that the object should be in.
Valid values are `present`, `absent`, `role`.
([↑ Back to user attributes](#user-attributes))
#### allowdupe {#user-attribute-allowdupe}
Whether to allow duplicate UIDs.
Valid values are `true`, `false`, `yes`, `no`.
([↑ Back to user attributes](#user-attributes))
#### attribute_membership {#user-attribute-attribute_membership}
Whether specified attribute value pairs should be treated as the
**complete list** (`inclusive`) or the **minimum list** (`minimum`) of
attribute/value pairs for the user.
Valid values are `inclusive`, `minimum`.
([↑ Back to user attributes](#user-attributes))
#### attributes {#user-attribute-attributes}
_(**Property:** This attribute represents concrete state on the target system.)_
Specify AIX attributes for the user in an array or hash of attribute = value pairs.
For example:
```
['minage=0', 'maxage=5', 'SYSTEM=compat']
```
or
```
attributes => { 'minage' => '0', 'maxage' => '5', 'SYSTEM' => 'compat' }
```
Requires features manages_aix_lam.
([↑ Back to user attributes](#user-attributes))
#### auth_membership {#user-attribute-auth_membership}
Whether specified auths should be considered the **complete list**
(`inclusive`) or the **minimum list** (`minimum`) of auths the user
has. This setting is specific to managing Solaris authorizations.
Valid values are `inclusive`, `minimum`.
([↑ Back to user attributes](#user-attributes))
#### auths {#user-attribute-auths}
_(**Property:** This attribute represents concrete state on the target system.)_
The auths the user has. Multiple auths should be
specified as an array.
Requires features manages_solaris_rbac.
([↑ Back to user attributes](#user-attributes))
#### comment {#user-attribute-comment}
_(**Property:** This attribute represents concrete state on the target system.)_
A description of the user. Generally the user's full name.
([↑ Back to user attributes](#user-attributes))
#### expiry {#user-attribute-expiry}
_(**Property:** This attribute represents concrete state on the target system.)_
The expiry date for this user. Provide as either the special
value `absent` to ensure that the account never expires, or as
a zero-padded YYYY-MM-DD format -- for example, 2010-02-19.
Valid values are `absent`. Values can match `/^\d{4}-\d{2}-\d{2}$/`.
Requires features manages_expiry.
([↑ Back to user attributes](#user-attributes))
#### forcelocal {#user-attribute-forcelocal}
Forces the management of local accounts when accounts are also
being managed by some other Name Service Switch (NSS). For AIX, refer to the `ia_load_module` parameter.
This option relies on your operating system's implementation of `luser*` commands, such as `luseradd` , and `lgroupadd`, `lusermod`. The `forcelocal` option could behave unpredictably in some circumstances. If the tools it depends on are not available, it might have no effect at all.
Valid values are `true`, `false`, `yes`, `no`.
Requires features manages_local_users_and_groups.
([↑ Back to user attributes](#user-attributes))
#### gid {#user-attribute-gid}
_(**Property:** This attribute represents concrete state on the target system.)_
The user's primary group. Can be specified numerically or by name.
This attribute is not supported on Windows systems; use the `groups`
attribute instead. (On Windows, designating a primary group is only
meaningful for domain accounts, which Puppet does not currently manage.)
([↑ Back to user attributes](#user-attributes))
#### groups {#user-attribute-groups}
_(**Property:** This attribute represents concrete state on the target system.)_
The groups to which the user belongs. The primary group should
not be listed, and groups should be identified by name rather than by
GID. Multiple groups should be specified as an array.
([↑ Back to user attributes](#user-attributes))
#### home {#user-attribute-home}
_(**Property:** This attribute represents concrete state on the target system.)_
The home directory of the user. The directory must be created
separately and is not currently checked for existence.
([↑ Back to user attributes](#user-attributes))
#### ia_load_module {#user-attribute-ia_load_module}
The name of the I&A module to use to manage this user.
This should be set to `files` if managing local users.
Requires features manages_aix_lam.
([↑ Back to user attributes](#user-attributes))
#### iterations {#user-attribute-iterations}
_(**Property:** This attribute represents concrete state on the target system.)_
This is the number of iterations of a chained computation of the
[PBKDF2 password hash](https://en.wikipedia.org/wiki/PBKDF2). This parameter
is used in OS X, and is required for managing passwords on OS X 10.8 and
newer.
Requires features manages_password_salt.
([↑ Back to user attributes](#user-attributes))
#### key_membership {#user-attribute-key_membership}
Whether specified key/value pairs should be considered the
**complete list** (`inclusive`) or the **minimum list** (`minimum`) of
the user's attributes.
Valid values are `inclusive`, `minimum`.
([↑ Back to user attributes](#user-attributes))
#### keys {#user-attribute-keys}
_(**Property:** This attribute represents concrete state on the target system.)_
Specify user attributes in an array of key = value pairs.
Requires features manages_solaris_rbac.
([↑ Back to user attributes](#user-attributes))
#### loginclass {#user-attribute-loginclass}
_(**Property:** This attribute represents concrete state on the target system.)_
The name of login class to which the user belongs.
Requires features manages_loginclass.
([↑ Back to user attributes](#user-attributes))
#### managehome {#user-attribute-managehome}
Whether to manage the home directory when Puppet creates or removes the user.
This creates the home directory if Puppet also creates the user account, and deletes the
home directory if Puppet also removes the user account.
This parameter has no effect unless Puppet is also creating or removing the user in the
resource at the same time. For instance, Puppet creates a home directory for a managed
user if `ensure => present` and the user does not exist at the time of the Puppet run.
If the home directory is then deleted manually, Puppet will not recreate it on the next
run.
Note that on Windows, this manages creation/deletion of the user profile instead of the
home directory. The user profile is stored in the `C:\Users\<username>` directory.
Valid values are `true`, `false`, `yes`, `no`.
([↑ Back to user attributes](#user-attributes))
#### membership {#user-attribute-membership}
If `minimum` is specified, Puppet will ensure that the user is a
member of all specified groups, but will not remove any other groups
that the user is a part of.
If `inclusive` is specified, Puppet will ensure that the user is a
member of **only** specified groups.
Valid values are `inclusive`, `minimum`.
([↑ Back to user attributes](#user-attributes))
#### password {#user-attribute-password}
_(**Property:** This attribute represents concrete state on the target system.)_
The user's password, in whatever encrypted format the local system
requires. Consult your operating system's documentation for acceptable password
encryption formats and requirements.
* Mac OS X 10.5 and 10.6, and some older Linux distributions, use salted SHA1
hashes. You can use Puppet's built-in `sha1` function to generate a salted SHA1
hash from a password.
* Mac OS X 10.7 (Lion), and many recent Linux distributions, use salted SHA512
hashes. The Puppet Labs [stdlib][] module contains a `str2saltedsha512` function
which can generate password hashes for these operating systems.
* OS X 10.8 and higher use salted SHA512 PBKDF2 hashes. When managing passwords
on these systems, the `salt` and `iterations` attributes need to be specified as
well as the password.
* macOS 10.15 and later require the salt to be 32 bytes. Because Puppet's user
resource requires the value to be hex encoded, the length of the salt's
string must be 64.
* Windows passwords can be managed only in cleartext, because there is no Windows
API for setting the password hash.
[stdlib]: https://github.com/puppetlabs/puppetlabs-stdlib/
Enclose any value that includes a dollar sign ($) in single quotes (') to avoid
accidental variable interpolation.
To redact passwords from reports to PuppetDB, use the `Sensitive` data type. For
example, this resource protects the password:
```puppet
user { 'foo':
ensure => present,
password => Sensitive("my secret password")
}
```
This results in the password being redacted from the report, as in the
`previous_value`, `desired_value`, and `message` fields below.
```yaml
events:
- !ruby/object:Puppet::Transaction::Event
audited: false
property: password
previous_value: "[redacted]"
desired_value: "[redacted]"
historical_value:
message: changed [redacted] to [redacted]
name: :password_changed
status: success
time: 2017-05-17 16:06:02.934398293 -07:00
redacted: true
corrective_change: false
corrective_change: false
```
Requires features manages_passwords.
([↑ Back to user attributes](#user-attributes))
#### password_max_age {#user-attribute-password_max_age}
_(**Property:** This attribute represents concrete state on the target system.)_
The maximum number of days a password may be used before it must be changed.
Requires features manages_password_age.
([↑ Back to user attributes](#user-attributes))
#### password_min_age {#user-attribute-password_min_age}
_(**Property:** This attribute represents concrete state on the target system.)_
The minimum number of days a password must be used before it may be changed.
Requires features manages_password_age.
([↑ Back to user attributes](#user-attributes))
#### password_warn_days {#user-attribute-password_warn_days}
_(**Property:** This attribute represents concrete state on the target system.)_
The number of days before a password is going to expire (see the maximum password age) during which the user should be warned.
Requires features manages_password_age.
([↑ Back to user attributes](#user-attributes))
#### profile_membership {#user-attribute-profile_membership}
Whether specified roles should be treated as the **complete list**
(`inclusive`) or the **minimum list** (`minimum`) of roles
of which the user is a member.
Valid values are `inclusive`, `minimum`.
([↑ Back to user attributes](#user-attributes))
#### profiles {#user-attribute-profiles}
_(**Property:** This attribute represents concrete state on the target system.)_
The profiles the user has. Multiple profiles should be
specified as an array.
Requires features manages_solaris_rbac.
([↑ Back to user attributes](#user-attributes))
#### project {#user-attribute-project}
_(**Property:** This attribute represents concrete state on the target system.)_
The name of the project associated with a user.
Requires features manages_solaris_rbac.
([↑ Back to user attributes](#user-attributes))
#### provider {#user-attribute-provider}
The specific backend to use for this `user`
resource. You will seldom need to specify this --- Puppet will usually
discover the appropriate provider for your platform.
Available providers are:
* [`aix`](#user-provider-aix)
* [`directoryservice`](#user-provider-directoryservice)
* [`hpuxuseradd`](#user-provider-hpuxuseradd)
* [`ldap`](#user-provider-ldap)
* [`openbsd`](#user-provider-openbsd)
* [`pw`](#user-provider-pw)
* [`user_role_add`](#user-provider-user_role_add)
* [`useradd`](#user-provider-useradd)
* [`windows_adsi`](#user-provider-windows_adsi)
([↑ Back to user attributes](#user-attributes))
#### purge_ssh_keys {#user-attribute-purge_ssh_keys}
Whether to purge authorized SSH keys for this user if they are not managed
with the `ssh_authorized_key` resource type. This parameter is a noop if the
ssh_authorized_key type is not available.
Allowed values are:
* `false` (default) --- don't purge SSH keys for this user.
* `true` --- look for keys in the `.ssh/authorized_keys` file in the user's
home directory. Purge any keys that aren't managed as `ssh_authorized_key`
resources.
* An array of file paths --- look for keys in all of the files listed. Purge
any keys that aren't managed as `ssh_authorized_key` resources. If any of
these paths starts with `~` or `%h`, that token will be replaced with
the user's home directory.
Valid values are `true`, `false`.
([↑ Back to user attributes](#user-attributes))
#### role_membership {#user-attribute-role_membership}
Whether specified roles should be considered the **complete list**
(`inclusive`) or the **minimum list** (`minimum`) of roles the user
has.
Valid values are `inclusive`, `minimum`.
([↑ Back to user attributes](#user-attributes))
#### roles {#user-attribute-roles}
_(**Property:** This attribute represents concrete state on the target system.)_
The roles the user has. Multiple roles should be
specified as an array.
Requires features manages_roles.
([↑ Back to user attributes](#user-attributes))
#### salt {#user-attribute-salt}
_(**Property:** This attribute represents concrete state on the target system.)_
This is the 32-byte salt used to generate the PBKDF2 password used in
OS X. This field is required for managing passwords on OS X >= 10.8.
Requires features manages_password_salt.
([↑ Back to user attributes](#user-attributes))
#### shell {#user-attribute-shell}
_(**Property:** This attribute represents concrete state on the target system.)_
The user's login shell. The shell must exist and be
executable.
This attribute cannot be managed on Windows systems.
Requires features manages_shell.
([↑ Back to user attributes](#user-attributes))
#### system {#user-attribute-system}
Whether the user is a system user, according to the OS's criteria;
on most platforms, a UID less than or equal to 500 indicates a system
user. This parameter is only used when the resource is created and will
not affect the UID when the user is present.
Valid values are `true`, `false`, `yes`, `no`.
([↑ Back to user attributes](#user-attributes))
#### uid {#user-attribute-uid}
_(**Property:** This attribute represents concrete state on the target system.)_
The user ID; must be specified numerically. If no user ID is
specified when creating a new user, then one will be chosen
automatically. This will likely result in the same user having
different UIDs on different systems, which is not recommended. This is
especially noteworthy when managing the same user on both Darwin and
other platforms, since Puppet does UID generation on Darwin, but
the underlying tools do so on other platforms.
On Windows, this property is read-only and will return the user's
security identifier (SID).
([↑ Back to user attributes](#user-attributes))
### Providers {#user-providers}
#### aix {#user-provider-aix}
User management for AIX.
* Required binaries: `/bin/chpasswd`, `/usr/bin/chuser`, `/usr/bin/mkuser`, `/usr/sbin/lsuser`, `/usr/sbin/rmuser`.
* Default for `os.name` == `aix`.
* Supported features: `manages_aix_lam`, `manages_expiry`, `manages_homedir`, `manages_local_users_and_groups`, `manages_password_age`, `manages_passwords`, `manages_shell`.
#### directoryservice {#user-provider-directoryservice}
User management on OS X.
* Required binaries: `/usr/bin/dscacheutil`, `/usr/bin/dscl`, `/usr/bin/dsimport`, `/usr/bin/uuidgen`.
* Default for `os.name` == `darwin`.
* Supported features: `manages_password_salt`, `manages_passwords`, `manages_shell`.
#### hpuxuseradd {#user-provider-hpuxuseradd}
User management for HP-UX. This provider uses the undocumented `-F`
switch to HP-UX's special `usermod` binary to work around the fact that
its standard `usermod` cannot make changes while the user is logged in.
New functionality provides for changing trusted computing passwords and
resetting password expirations under trusted computing.
* Required binaries: `/usr/sam/lbin/useradd.sam`, `/usr/sam/lbin/userdel.sam`, `/usr/sam/lbin/usermod.sam`.
* Default for `os.name` == `hp-ux`.
* Supported features: `allows_duplicates`, `manages_homedir`, `manages_passwords`.
#### ldap {#user-provider-ldap}
User management via LDAP.
This provider requires that you have valid values for all of the
LDAP-related settings in `puppet.conf`, including `ldapbase`. You will
almost definitely need settings for `ldapuser` and `ldappassword` in order
for your clients to write to LDAP.
Note that this provider will automatically generate a UID for you if
you do not specify one, but it is a potentially expensive operation,
as it iterates across all existing users to pick the appropriate next one.
* Supported features: `manages_passwords`, `manages_shell`.
#### openbsd {#user-provider-openbsd}
User management via `useradd` and its ilk for OpenBSD. Note that you
will need to install Ruby's shadow password library (package known as
`ruby-shadow`) if you wish to manage user passwords.
* Required binaries: `passwd`, `useradd`, `userdel`, `usermod`.
* Default for `os.name` == `openbsd`.
* Supported features: `manages_expiry`, `manages_homedir`, `manages_shell`, `system_users`.
#### pw {#user-provider-pw}
User management via `pw` on FreeBSD and DragonFly BSD.
* Required binaries: `pw`.
* Default for `os.name` == `freebsd, dragonfly`.
* Supported features: `allows_duplicates`, `manages_expiry`, `manages_homedir`, `manages_passwords`, `manages_shell`.
#### user_role_add {#user-provider-user_role_add}
User and role management on Solaris, via `useradd` and `roleadd`.
* Required binaries: `passwd`, `roleadd`, `roledel`, `rolemod`, `useradd`, `userdel`, `usermod`.
* Default for `os.family` == `solaris`.
* Supported features: `allows_duplicates`, `manages_homedir`, `manages_password_age`, `manages_passwords`, `manages_roles`, `manages_shell`, `manages_solaris_rbac`.
#### useradd {#user-provider-useradd}
User management via `useradd` and its ilk. Note that you will need to
install Ruby's shadow password library (often known as `ruby-libshadow`)
if you wish to manage user passwords.
To use the `forcelocal` parameter, you need to install the `libuser` package (providing
`/usr/sbin/lgroupadd` and `/usr/sbin/luseradd`).
* Required binaries: `chage`, `chpasswd`, `lchage`, `luseradd`, `luserdel`, `lusermod`, `useradd`, `userdel`, `usermod`.
* Supported features: `allows_duplicates`, `manages_expiry`, `manages_homedir`, `manages_shell`, `system_users`.
#### windows_adsi {#user-provider-windows_adsi}
Local user management for Windows.
* Default for `os.name` == `windows`.
* Supported features: `manages_homedir`, `manages_passwords`, `manages_roles`.
### Provider Features {#user-provider-features}
Available features:
* `allows_duplicates` --- The provider supports duplicate users with the same UID.
* `manages_aix_lam` --- The provider can manage AIX Loadable Authentication Module (LAM) system.
* `manages_expiry` --- The provider can manage the expiry date for a user.
* `manages_homedir` --- The provider can create and remove home directories.
* `manages_local_users_and_groups` --- Allows local users to be managed on systems that also use some other remote Name Service Switch (NSS) method of managing accounts.
* `manages_loginclass` --- The provider can manage the login class for a user.
* `manages_password_age` --- The provider can set age requirements and restrictions for passwords.
* `manages_password_salt` --- The provider can set a password salt. This is for providers that implement PBKDF2 passwords with salt properties.
* `manages_passwords` --- The provider can modify user passwords, by accepting a password hash.
* `manages_roles` --- The provider can manage roles
* `manages_shell` --- The provider allows for setting shell and validates if possible
* `manages_solaris_rbac` --- The provider can manage normal users
* `system_users` --- The provider allows you to create system users with lower UIDs.
Provider support:
* **aix** - _manages aix lam, manages expiry, manages homedir, manages local users and groups, manages password age, manages passwords, manages shell_
* **directoryservice** - _manages password salt, manages passwords, manages shell_
* **hpuxuseradd** - _allows duplicates, manages homedir, manages passwords_
* **ldap** - _manages passwords, manages shell_
* **openbsd** - _manages expiry, manages homedir, manages shell, system users, manages passwords, manages loginclass_
* **pw** - _allows duplicates, manages expiry, manages homedir, manages passwords, manages shell_
* **user_role_add** - _allows duplicates, manages homedir, manages password age, manages passwords, manages roles, manages shell, manages solaris rbac_
* **useradd** - _allows duplicates, manages expiry, manages homedir, manages shell, system users, manages passwords, manages password age, libuser_
* **windows_adsi** - _manages homedir, manages passwords, manages roles_
|